Migrating Windows 7 from VirtualBox to KVM

First we convert the vbox image to a KVM format (qcow2) in 2 steps:
VBoxManage clonehd --format raw /path/to/image.vdi /path/to/image.img
qemu-img convert -f raw /path/to/image.img -O qcow2 /path/to/image.qcow2

If you get an error saying Cannot register the hard disk becuase a hard disk with UUID already exists
then we need to change the UUID:
vboxmanage internalcommands sethduuid /path/to/image.vdi
You should get a messagle like this one : UUID changed to: 4fb96311-e694-4ae1-a5d3-60cd9e96f843

After you add the image.qcow2 to KVM Virtual Machine Manager you’ll probably notice that the new vm will not boot.
I had a Win7 iso image which I’ve added to KVM as an IDE CDROM and booted from it. Go to Repair Windows and select the command prompt.
Go to you your CD DRIVE (F in my case)
F:
cd boot
bootsect /ntsys60 /mbr
That will fix the mbr sector on your qcow image and Windows should boot now.

Install Windows VirtIO Drivers
http://www.linux-kvm.org/page/WindowsGuestDrivers/Download_Drivers
https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Host_Configuration_and_Guest_Installation_Guide/form-Virtualization_Host_Configuration_and_Guest_Installation_Guide-Para_virtualized_drivers-Mounting_the_image_with_virt_manager.html

Install Spice Guest Tools from http://www.spice-space.org/download.html

These are the summarized steps required for a succesful vbox to kvm migration.
Good luck 🙂

This entry was posted in Linux and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *