How to convert between VirtualBox VDI and VMware VMDK

There are several disk image formats used by virtualization software; VDI for Oracle VM VirtualBox, and VMDK for VMware vSphere, to name a few. If you want to convert VirtulBox VDI image to VMware VMDK image, or vice versa, there are two command-line utilities available to use.

The first tool is VBoxManage, which is a command-line utility that comes with VirtualBox. If you already installed VirtualBox on your system, VBoxManage is ready for use right away without installing any other software.

The second Linux tool is qemu-img command which is part of qemu hardware virtualization package.

To use qemu-img on Ubuntu or Debian:

$ sudo apt-get install qemu-utils

To use qemu-img on CentOS, Fedora or RHEL:

$ sudo yum install qemu

Assuming that you have either of these two command-line tools available on your system, I will show how to convert between VirtualBox VDI and VMware VMDK formats, and how to import a converted standalone disk image in a VM. Before conversion, make sure to power off the VM whose disk image is being converted.

Convert VMware VMDK to VirtualBox VDI

To convert VMDK to VDI with VboxManage:

$ VBoxManage clonehd --format VDI input.vmdk output.vdi

To convert VMDK to VDI with qemu-img:

$ qemu-img convert input.vmdk -O vdi output.vdi

Import VDI disk image in VirtualBox VM

Once you create a VDI-formatted disk image from a VMDK counterpart, you can create a new VM on VirtualBox, and attach the VDI image to the VM. While creating a VM, just choose "Use an existing virtual hard drive file" option, and use the existing VDI image file.

Convert VirtualBox VDI to VMware VMDK

To convert VDI to VMDK with VboxManage:

$ VBoxManage clonehd --format VMDK input.vdi output.vmdk

To convert VDI to VMDK with qemu-img:

$ qemu-img convert input.vdi -O vmdk output.vmdk

Import VMDK disk image in VMware VM

Once you obtained a VMDK disk image from a VDI image, you can attach the standalone VMDK disk image to a VMware VM as follows.

First, create a new VM by using VM creation wizard. When asked to choose an OS installation option, choose "I will install operating system later" option, as shown in the following. That way, it will skip disk image creation.

Once.vmx file is created, edit the .vmx file to specify the existing VMDK image file as follows.

scsi0:0.fileName = "/path/to/vmdk/output.vmdk"

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of Xmodulo.com. He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

One thought on “How to convert between VirtualBox VDI and VMware VMDK

  1. when i try to convert VDMK to VDI using VBoxManage i end up with this message.

    Rizwa-MacBook-Pro:~ Rizwa$ VBoxManage clonehd --format VDI input.vmdk output.vdi
    VBoxManage: error: Could not find file for the medium '/Users/Rizwa/input.vmdk' (VERR_FILE_NOT_FOUND)
    VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component Medium, interface IMedium, callee nsISupports
    VBoxManage: error: Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 178 of file VBoxManageDisk.cpp

Leave a comment

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

Current ye@r *