How to run Windows 7 partition as a VM in libvirt/Ubuntu/qemu?
Linux - Virtualization and CloudThis forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
As you say, by default Windows 7 will create two partitions; one 100 Mb partition for the boot loader and a few system files, and a second partition for the main OS. Only the second partition is visible as a mounted file system in Windows (C:), although the first can be seen in Disk Manager.
In order for Windows to boot, both partitions must be available. As far as I know, you cannot create a "virtual" disk in qemu from two separate partitions, so the only way to make this work would be to make the entire sda disk available to the VM.
Should still work to boot to qemu -m 1G -hda \\(I forget this exactly for partition) -hdb \\.\hd1 or some such. See qemu doc's.
Probably not, as the Windows boot loader will expect to find the OS on \Device\Harddisk0\Partition2, not \Device\Harddisk1\Partition1. He could fix that by rebuilding the boot loader, but would then lose the ability to boot directly from the physical disk.
Originally Posted by jefro
The HAL will be messed up.
The HAL is not likely to cause any trouble, but the storage driver might. Most modern hardware uses AHCI, while I believe Qemu emulates a PIIX IDE controller. Installing Windows 7 on a system with an AHCI controller will leave the IDE driver disabled. He will probably need to boot the OS on the physical hardware and enable the IDE driver manually.
Should he eventually succeed in migrating the OS to a VM, the licensing service will most likely complain loudly about changed hardware and demand reactivation.
Hello lifeboy. I can not answer your question exactly, but a while ago i desired a similar thing.
I have written detailed instructions on how i managed to boot my Windows 7 partition in virtualbox, from Debian.
As Knightron points out there are some needed fixes. In his original post I suggested a P2V app that fixes all of this. In any case the authentication scheme that MS uses will most likely be triggered. A VM is not using enough of the real hardware to let it slide. Only the processor is a registered device and even in qemu that can be changed. So HAL and activation will have to be looked at. Depending on the P2V app used some of that is automated and even transparent to the user. The better P2V apps will break the existing install. They assume you are never going back to the hardware install.
Knightron used the entire disk which is not exactly what the OP requested but it is a good to know way to attempt this.
Using a VM to boot to an existing or dual use physical drive isn't really practical.