How can I convert vmware disk images to kvm ?

I was going through different utilities to convert, the image file formats to other formats . Checking in my fedora system , it turned out to a command called “qemu-img” which can be used for it ..

The “qemu-img” command can be used to convert the different image file formats ( raw, cow, qcow, qcow2, vmdk,cloop) to and from. VMware has an option that allows you to split up a large image, let us say 8G, into four file of 2G each. If the source file which you are converting is part of the split file format, the resultant image will not work as intended. If it is a 2Gb split format, you need to convert such disks to single file prior to conversion using vmware-vdiskmanager.

Once it is converted to single file you can convert it by “qemu-img” to any of the supported format.

Below was the process I followed for achieving it..

[root@humbles-lap test]# du -sh RHEL5u364.vmdk
2.3G RHEL5u364.vmdk
[root@humbles-lap test]# qemu-img
qemu-img version 0.9.1, Copyright (c) 2004-2008 Fabrice Bellard
usage: qemu-img command [command options]
QEMU disk image utility

==>”qemu-img” binary is provided by “kvm-qemu-img” package.

[root@humbles-lap test]# qemu-img convert -f vmdk RHEL5u364.vmdk -O qcow2 esb01.dev.qcow2
[root@humbles-lap test]# ls
esb01.dev.qcow2 lost+found RHEL5u364.vmdk
[root@humbles-lap test]# file esb01.dev.qcow2
esb01.dev.qcow2: QEMU Copy-On-Write disk image version 2, size 0 + -1073741824

After this , I used the same image and started one new guest . It successfully booted.

Leave a Reply

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