virtualization -- how do I use an existing windows installation ?

Bill Davidsen davidsen at tmr.com
Wed Nov 4 21:17:32 UTC 2009


steve wrote:
> Hi,
> 
> I recently installed windows 7 on my laptop, on a separate partition, 
> making it dual boot. Now, I would like to boot into this installation 
> without having to reboot. A casual google shows me that one can in fact 
> boot off an existing physical partition using any of the commonly 
> available virtualization tools on linux -- qemu, VirtualBox & VMPlayer.
> 
> So my question is, has anyone tried doing this and what were your 
> experiences if you did ?
> 
> I am not averse to the idea of simply reinstalling windows 7 in a 
> 'proper' virtual environment, but just curious whether reusing the 
> existing installation is easily doable. I would be using the windows 
> installation just to test portability of code that i write. I don't 
> really need to boot into it often, neither do i expect it to be 
> lightning fast.
> 
I have booted XP as a virtual machine, using the *whole disk* under kvm. You 
must have a boot manager installed, and must *not* try to boot Linux under 
Linux, as you are likely to totally hose all your files. But running XP I was 
able to boot up and do a little browsing as a proof of concept. It requires kvm, 
if your hardware supports it modprobe to load the correct amd or intel kvm, then:

1 - qemu-img -c -b /dev/sda -f qcow2 MyVirtDisk.img
2 - qemu-kvm -m 512 -hda MyVirtDisk.img -net nic -soundhw es1370

At that point you will have a VM and should (may) be able to boot Windows from 
the boot manager. Note that any changes will go in the image file, not to the disk.

I had no luck running as a partition, Windows expects a disk.

Note: this is probably dangerous in some way, I actually did "-hda /dev/sda" 
which meant any stupid thing I did would be permanent. With the copy I din't 
believe you can hurt yourself, but that's just my guess.

-- 
Bill Davidsen <davidsen at tmr.com>
   "We have more to fear from the bungling of the incompetent than from
the machinations of the wicked."  - from Slashdot




More information about the users mailing list