User Tools

Site Tools


How to Convert a VMDK to a VDI

There are two main file standards for virtual machines: VMDK and VDI (used by VMWare and VirtualBox, respectively). VMWare has an appliance marketplace, so many VM's are available in the VMDK format. I wanted to use a VMWare appliance, but VMWare cannot run a 64-bit guest OS on a 32-bit host (as of mid-2011). But Virtual Box can. This is how I converted my image.

Merge Segments

My image consisted of multiple segments (i.e. files).

# ls
stratos-1.0.0.nvram      stratos-1.0.0-s002.vmdk  stratos-1.0.0-s004.vmdk  stratos-1.0.0-s006.vmdk  stratos-1.0.0-s008.vmdk  stratos-1.0.0-s010.vmdk  stratos-1.0.0.vmdk  stratos-1.0.0.vmx
stratos-1.0.0-s001.vmdk  stratos-1.0.0-s003.vmdk  stratos-1.0.0-s005.vmdk  stratos-1.0.0-s007.vmdk  stratos-1.0.0-s009.vmdk  stratos-1.0.0-s011.vmdk  stratos-1.0.0.vmsd  stratos-1.0.0.vmxf

They need to be assembled into one large file before they can be converted to anything else. I used VMWare's vmware-vdiskmanager for this.

# vmware-vdiskmanager -r stratos-1.0.0.vmdk -t 0 stratos_new.vmdk
Creating disk 'stratos_new.vmdk'
  Convert: 100% done.
Virtual disk conversion successful.

This gave me one very large file called stratos_new.vmdk. Its size was equal to the sum of its parts (meaning all the stratos-1.0.0-s* files).

Convert VMDK to BIN

Now the file needs to be converted to its full uncompressed size. This can be done with qemu, which I didn't have installed. I ran this command to install it:

sudo apt-get install qemu

And then ran this command to convert the VMDK into a BIN file.

# qemu-img convert stratos_new.vmdk stratos_raw.bin

The resulting bin file was HUGE (i.e. 20GB, compared to 4.7GB for the VMDK file).

Convert BIN to VDI

Recent versions of VirtualBox have a built-in way to convert BIN images to VDI format.

# VBoxManage convertdd stratos_raw.bin stratos-1.0.0.vdi

This resulted in a 4.7GB VDI file–the same size as the merged VMDK file.


I immediately deleted the huge bin file, and the merged VMDK file since those were temporary.

# rm stratos_new.vmdk stratos_raw.bin

Then, since I had downloaded the original appliance from the web and still had a backup, I deleted all the other VMWare-related files.

# rm -rf stratos*.vm*
/home/cfreyer/public_html/data/pages/technology/convert_vmdk_to_vdi.txt · Last modified: 2011/04/26 15:47 by Chris Freyer