Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have two partitions on my hard drive, one for Windows and one for linux. I would like to use VirtualBox in Linux to boot the Windows partition as a virtual machine. How can I acheive this?

share|improve this question
7  
If you're planning to sometimes boot the partition physically and sometimes virtually, be aware that this isn't easy to set up. Windows doesn't like having the hardware changed underneath it. –  Harry Johnston Jul 20 '12 at 21:48

2 Answers 2

From chapter 9 of the VirtualBox manual:

To create a special image for raw partition support (which will contain a small amount of data, as already mentioned), on a Linux host, use the command

VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/sda -partitions 1,5

This example would create the image /path/to/file.vmdk (which, again, must be absolute), and partitions 1 and 5 of /dev/sda would be made accessible to the guest.

For example, if your hard drive is /dev/sda/ and the Windows partition is /dev/sda2, the command you use might look like:

VBoxManage internalcommands createrawvmdk -filename ~/windows.vmdk -rawdisk /dev/sda -partitions 2

This would create a file, windows.vmdk, in your home folder, which you would then mount in the virtual machine.

share|improve this answer
    
This may work if you install virtualbox.org/attachment/wiki/Migrate_Windows/MergeIDE.zip first. Cool idea for sure. –  khaki54 Jan 2 '13 at 20:11

I love virtualbox

but normally you can't just all of a sudden virtualize a physical windows computer into a virtual one by just reading the hard drive from Virtualbox. (experience and source) Tapped-out's solution seems easier, but I don't think you will boot successfully. You may want to try it first though. Hopefully your windows install doesn't get corrupted when it tries to load all new drivers, etc. but it will probably just BSOD immediately.

If tapped-out's solution doesn't work, go ahead and try this.

Use the vmware standalone converter tool: Make sure you have vmware player (free) installed also.

VMware standalone will let you convert a virtual machine, running physical machine, or an acronis true image backup to a virtual machine. It will also do something to all the drivers so that your machine will work virtually.

  1. if you tried tapped-out's solution, point vmware-converter at at that virtualbox vm you created there. vmware-converter will read it, convert it to a virtual machine, fix the drivers, and install it in vmware player. From there you can convert it to virtualbox format if you want, or just use player.

  2. If you didn't try his solution, or if option 1 did not like the rawdisk read and failed, Virtualbox has a really good article, on converting a real windows install to virtualbox, using linux.

Basically,

  • Install MergeIDE on the windows machine first
  • cat /dev/sdg | VBoxManage convertfromraw stdin OutPutFile.vdi NUMBEROFBYTES
  • add drive to virtualbox and create new vm
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.