Convert a VMWare VMDK disk image to Xen HVM

http://linux.cloudibee.com/2008/11/vmware-to-xen-conversion

Here are the steps for converting Vmware windows/linux guest to Xen format. You need qemu-img tool (from the qemu-utils package) for the conversion.

Extra Step for Converting a Vmware Windows VM Guest

You first have to ensure that your image has IDE drivers installed (see Microsoft kb314082)

Check the format of the vmware vmdk file

Halt the vmware VM.

# qemu-img info FreeNAS-9.2.1.5-RELEASE-x64.vmdk
image: FreeNAS-9.2.1.5-RELEASE-x64.vmdk
file format: vmdk
virtual size: 1.9G (2000027648 bytes)
disk size: 846M

If the file format is “raw”, we do not need to convert the image file using qemu-img convert, just rename to file with the .img extension. If it is not “raw”, use “qemu-img” to convert the image to raw format.

Convert Using qemu-img

# qemu-img convert FreeNAS-9.2.1.5-RELEASE-x64.vmdk -O raw /var/opt/localImg/FreeNAS-9.2.1.5-RELEASE-x64.img

Create Xen Config File

Create the Xen config file in /etc/xen/guest22, with the renamed/converted image file as disk.

disk = [ 'file:/volumes/guest22/guest22.img,hda,w' ]

Boot up the Xen domU Guest

It should boot up fine.