On my laptop I have a 10G XP partition. It’s the only Windows I own and came with the laptop. Currently, I have a need for Windows, to run SharpDevelop(WinCE code for the GPS project) and for testing of another “secret project”. Since the HD on my laptop is on the small side, I’d like to reclaim XP’s 10G and not have a dedicated Windows partition anymore. I’ve been reading that Qemu is relatively decent currently so I decided to try and go the virtual machine route. I don’t have any XP installation media(thank you IBM for shipping only “recover” CD’s!!!) so I figured I could turn my current working XP partition into a disk image for Qemu.Build the qemu image.
dd if=/dev/hda2 of=winxp.img bs=1M
Convert the raw image into vmdk. Why I did this I’ll explain later.
qemu-img convert winxp.img -O vmdk winxp.vmdk
At this point I had made a mistake. I had turned a partition into a disk image, no partition table, no boot record, etc. How to get around that? Create another vmdk image, partition that correctly and move the XP image into the proper partition of the new vmdk image.I had a Knoppix CD laying on my desk, booted that under qemu.
qemu -cdrom /dev/hdc -hda WinXP.vmdk -hdb new.vmdk -boot d WinXP.vmdk
where WinXP.vmdk is the broken image of XP from my laptop and new.vmdk is the new(not yet partitioned image).from Knoppix
cfdisk /dev/hdb to partition new.vmdk
into 2 partitions. A 10M Ext2 and a 10G NTFS bootable partition.Next also from inside Knoppix, running in qemu, I move the contents of the XP image into the new NTFS partition inside the new empty image.
dd if=/dev/hda of=/dev/hdb2 bs=1M
Then, also from Knoppix, install Grub on the new disk image.
So why did I use the vmdk image format? vmdk is not only supported by qemu but also VMWare/VMPlayer. VMPlayer is supposedly a few times faster than qemu so using vmdk allows VMPlayer or qemu to be used as the VM.The moment of truth.
I get a grub prompt.
rootnoverify (hd0,0)makeactivechainloader +1boot
And………. nothing! Sits and spins…. Anyone have a clue?