Converting VMware disk images to use in KVM

From time to time, you may have a need to convert a VMware based virtual disk image into some other format.

If you use KVM as your virtualization technology or perhaps you are migrating from VMware to KVM, you will need to convert your VMware disk images (.vmdk files) into a supported image type that you can use in KVM.


Individual Image files

If you have a single vmdk file, you can convert it with the below command.

qemu-img convert -f vmdk disk-image.vmdk -O raw disk-image.img

Multiple spanned Image files

If you happen to have several vmdk files, you’ll need to convert each of them and join them together.

Below is how you can convert  a VMware Virtual Appliance (In this example, I am using the YubiRADIUS 3.6 image which can be downloaded here).

The YubiRADIUS VMware image consists of a 3  split files. Use the below 2 steps to create the images into one consistent file.

I have downloaded the archive to my /root/ directory.


I have extracted the YubiRADIUS appliance and the contents of the directory is as follows

[root@microserver01 ~]# unzip
 inflating: YubiRADIUS_Virtual_Appliance_V3.6/nvram
 inflating: YubiRADIUS_Virtual_Appliance_V3.6/Other Linux 2.6.x kernel.vmdk
 extracting: YubiRADIUS_Virtual_Appliance_V3.6/Other Linux 2.6.x kernel.vmsd
 inflating: YubiRADIUS_Virtual_Appliance_V3.6/Other Linux 2.6.x kernel.vmx
 inflating: YubiRADIUS_Virtual_Appliance_V3.6/Other Linux 2.6.x kernel-s001.vmdk
 inflating: YubiRADIUS_Virtual_Appliance_V3.6/Other Linux 2.6.x kernel-s002.vmdk
 inflating: YubiRADIUS_Virtual_Appliance_V3.6/Other Linux 2.6.x kernel-s003.vmdk
 inflating: YubiRADIUS_Virtual_Appliance_V3.6/vmware.log
 inflating: YubiRADIUS_Virtual_Appliance_V3.6/vmware-0.log
 inflating: YubiRADIUS_Virtual_Appliance_V3.6/vmware-1.log
 inflating: YubiRADIUS_Virtual_Appliance_V3.6/vmware-2.log
[root@microserver01 ~]#

The above shows that the Virtual Appliance contains a vmdk disk image which has been spanned across 3 sections.
There are 4 vmdk files in the extract.

[root@microserver01 ~]# ll YubiRADIUS_Virtual_Appliance_V3.6/*.vmdk
 -rw-r--r--. 1 root root 1176371200 Dec  8 00:51 YubiRADIUS_Virtual_Appliance_V3.6/Other Linux 2.6.x kernel-s001.vmdk
 -rw-r--r--. 1 root root 1400832000 Dec  8 00:51 YubiRADIUS_Virtual_Appliance_V3.6/Other Linux 2.6.x kernel-s002.vmdk
 -rw-r--r--. 1 root root  964624384 Dec  8 00:51 YubiRADIUS_Virtual_Appliance_V3.6/Other Linux 2.6.x kernel-s003.vmdk
 -rw-r--r--. 1 root root        479 Dec  7 21:31 YubiRADIUS_Virtual_Appliance_V3.6/Other Linux 2.6.x kernel.vmdk
[root@microserver01 ~]#

What is important to know is that although there is 4 files, the actual disk data is only stored in the 3 spanned files.
The file “Other Linux 2.6.x kernel.vmdk” is simply an index of the spanned image files.


To convert these files, we only need to convert each spanned file.

Run the following to convert the files into raw disk images.

[root@microserver01 ~]# for x in 1 2 3
> do qemu-img convert -f vmdk YubiRADIUS_Virtual_Appliance_V3.6/Other\ Linux\ 2.6.x\ kernel-s00$x.vmdk -O raw YubiRADIUS_Virtual_Appliance_V3.6-s00$x.img
> done
[root@microserver01 ~]#

Now you will have 3 new img files which we will now need to join together into one continuous file.

We achieve this with good old ‘cat’ command.

[root@microserver01 ~]# cat YubiRADIUS_Virtual_Appliance_V3.6-s00* >> YubiRADIUS_Virtual_Appliance_V3.6.img



Once you have merged the files together, you can simply add the “YubiRADIUS_Virtual_Appliance_V3.6.img” image file to a new KVM guest. Once you have done this, you will be able to simply power on the KVM guest.

Below is a screen shot of the YubiRADIUS 3.6 Virtual Appliance after booting the new raw KVM image.


One comment on “Converting VMware disk images to use in KVM

  1. tangawk November 13, 2015 18:48

    Fantastic and simple explanation. I had been trying for ages to get VM Workstation to install on Fedora 22 and getting bogged down with kernel header problems. This helped me to convert my VM ware windows 7 image and run it within Fedora with no extra software.

    Many thanks

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>