Migrating CentOS5 VMWare images with LVM to KVM

I’ve decided that using VMWare Server has been a useful and worthwhile experience, but I want to do stuff which would involve upgrading to one of the paid-for versions of VMWare and I don’t want to pay.

So, I’ve set up a new server to host my VMs on Fedora 14, and am migrating to using KVM instead.

I had expected that I’d have to backup the image and then recover it, but no, it seems that the open source community has done everything I need. I started here and noted the slightly scary caveat that LVM using images didn’t work.

I tried anyway, and sure enough, I got a message saying

Volume group "VolGroup00" not found
Unable to access resume device (/dev/VolGroup00/LogVol01)
mount: could not find filesystem '/dev/root'

It had to be possible. I asked at LinuxQuestions.org, and the reply led me to look at virt-p2v, which was a possible fallback option, but rather scary since there aren’t any hosted pre-build iso files any more.

However, reading some of the blurb on the author’s blog about manual p2v he mentioned possibly having to edit the fstab file to point the mounts in the right direction following virtualisation.

I had loaded the converted qcow2 image, using Virtual Machine Manager. When I looked at the setup I noticed that the disk setup looked like this:

Properties page for VirtIO disk.

I Googled VirtIO and found that it was a para-virtualised disk type, which meant that it had to be supported by the guest OS. This would explain why the Fedora 14 rescue disk could see the LVM but not the actual operating system.

I deleted the disk entry and replaced it with this:

Properties page for new IDE drive

Now, I started the guest, and it booted!

Text from successful boot image.

Upon booting, the X-window display didn’t work, but the automatic rescue process worked, and I got a gnome login screen. The next problem was that the mouse didn’t work properly. The Virtual Machine Manager does suggest that you add a tablet to the machine to ensure that the mouse matches the VNC mouse, but it still didn’t work after doing that. However, yet again, someone had done the work first, and I found the answer here. Slightly messy editing the xorg.conf file, but it worked.

Leave a Reply