VirtualBox to KVM Migration

What:

Virtualbox is a nice desktop virtualization software from erstwhile Sun Inc.  I used the personal use as well as open edition of it for quite sometime. However, could not resist the temptation to migrate to KVM, given its increasing roars in the virtualization space - both for desktop as well as server side. Not having a good tool to manage the VMs was a shortcoming of KVM for sometime. However, with Virt-Manger, this seems to have changed quite a lot. And so I started to migrate my windows image to KVM based.

Source:
Host OS: Ubuntu 10.04
Virtualization tool: VirtualBox
Guest OS: Windows XP Sp3

Target: 

Host OS: Ubuntu 10.04
Virtualization tool: KVM
Guest OS: Windows XP Sp3
objective is migrate this guest image to KVM so that the migration is seemless.

How:

Pre-planning:
  • Shut off windows XP gracefully. It probably might make a difference. But in anycase, will be a good idea rather than land up in surprise
  • You need reasonable space. nearly 3 times of the size of the windows xp file disc. 
  • You might need WindowsXP install iso or the setup disc. (I needed it)
Migrate the disc:
  • Migrate the file disc from .vdi format to .img first
    VBoxManage clonehd --format RAW windowsxp.vdi windowsxp.img
  • Migrate to .qcow2 format
    qemu-img convert -f raw windowsxp.img -O qcow2 windowsxp
Setup KVM:
  • Check if your hardware support hardware virtualization. If not, you can use qemu else use KVM
    cat /proc/cpuinfo | egrep "(vmx|svm)"
  • If the above command returned something, you should be all set to use KVM
  • Install kvm and virt-manager. You should be able to install these using synaptics or Ubuntu Software Center. There are command line tricks but do you care?
  • Configure a new VM with image as windowsxp.qcow
  • Run the new VM
  • In my case, I got my first bummer here - Blue Screen of Death
  • After a bit of googling, i found repairing the windows xp is the way to go. 
  • Boot the VM from the windows xp ISO or the boot CD.
  • Go the repair option on the installed image.
  • It took as long as it takes to install windows xp. However, it retained the entire OS as is. I have an active directory join on this VM, this was intact. No software was removed or modified.
  • In other words, when repair finished, i could login to the KVM based Windows XP as if I was the previous virtualbox VM.

Overall, a pleasant experience and a quick one too.
References:
  • http://blog.bodhizazen.net/linux/convert-virtualbox-vdi-to-kvm-qcow/
  • http://blog.mymediasystem.net/uncategorized/vmware-kvm-migration-guide/
  • http://outlyer.net/howtos-linux/kvm-qemu-notes/

Comments

Unknown said…
Cao,
thanx for You solution :-)