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:
To use qemu-img on CentOS, Fedora or RHEL:
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:
To convert VMDK to VDI with qemu-img:
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:
To convert VDI to VMDK with qemu-img:
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.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!
Latest posts by Dan Nanni (see all)
- How to switch from NetworkManager to systemd-networkd on Linux - August 31, 2015
- How to set up a system status page of your infrastructure - August 25, 2015
- How to configure virtual hosts in Apache HTTP server - August 24, 2015