Convert Virtual Disk Image VMWare VMDK to VirtualBox VDI

Convert Virtual Disk Image VMWare VMDK to VirtualBox VDI

Get Social!

virtual-boxOracle’s VirtualBox can use a few different virtual disk types, however their own disk type is VDI (VirtualBox Disk Image). It’s not one of the most widely used formats so if you’ve downloaded a VM, it’s unlikely its disk in is VDI format.

Luckily with the tools from VirtualBox you’re able to move virtual disks between VMDK and VDI formats.

The VBoxManage command is the Swis Army Knife of tools to manage all things VirtualBox. The VBoxManage command will need to be in your path to be able to use it. The easiest way is to navigate to your VirtualBox installation. On Windows open a new Command Prompt and navigate to your VirtualBox installation directory

cd c:\Program Files\Oracle\VirtualBox\

Now run the VBoxManage command with the clonehd switch to create a copy of your VMDK in the VDI format.

Before you start, make sure you remove any snapshots on the source disk, and ensure it’s not attached to a running virtual machine.

Run the below command and substitute your input and output virtual disk image paths:

VBoxManage clonehd --format VDI server1-disk1.vmdk c:\vms\server2\server2-disk1.vdi

In the above example, change server1-disk1.vmdk to your input VMDK disk and c:\vms\server2\server2-disk1.vdi to the path you’d like to store the ouput VDI.

Backup ESXi 5.x running virtual machine

Category : How-to

Get Social!

ESXi does not provide an option to backup a running virtual machine, without paying VMware a substantial amount of money. You can get round this by turning off the guest and copying the VMDK however this requires downtime for the guest. You cannot copy the VMDK while the guest is running because the VMDK virtual disk cannot be copied while it is in use. As this is likely to be the boot disk for the virtual machine, stopping disk activity without turning the instance off is impossible. The below simple script creates a snapshot of the guest which forces the guest to write all new changes to a new file instead of writing them to the virtual disk. This frees the disk to be copied. Once the copy has completed, the snapshot is removed writing all changes since the backup started back to the virtual disk.

This script contains little error checking and requires a few conditions to be met in order to complete successfully.
• No device maps for physical disks must exist in the instance
• ‘Independent’ disks must not exist in the instance
• The parameters of the script must be completed correctly.

There are 2 lines in the script which must be configured. Open the script using a text editor and change the below variables to match your preferences.


Copy the script to the below location on your ESXi server. The file name of the script should be VMbackupBash E.G. /usr/bin/VMbackupBash

To run the script, type
The machine name must be the name of the folder in BASE_PATH which contains the instance to backup.

#Backup VMware instance

echo ""
echo "-------------------------------"
echo "- VM Backup Script -"
echo "- James Coyle -"
echo "-------------------------------"
echo ""

#root path to where your running instances are stored.

#root path to where you would like to save the backup

#Do not edit
if [ "$1" ]; then

echo "Enter machine name: "


BACKUP_APPEND=$(date +"%Y%m%d-%H%M%S")

if [ -d $MACHINE_PATH ] && [ -d $BACKUP_ROOT ]; then


VIMID=`vim-cmd vmsvc/getallvms | egrep -o "[0-9]+[ ]+$MACHINE" | cut -d" " -f1`

if [ -z VIMID ]; then
echo "Could not get VM ID."
vim-cmd vmsvc/getallvms

echo ""
echo "Enter vimid of $MACHINE"
read VIMID
echo ""
echo ""


#Get existing files

for T in $FILE_ARRAY[@]
#echo "$I[$T]"

echo "- Backup info"
echo "-------------------------------"
echo " Machine path: $MACHINE_PATH"
echo " Backup path: $BACKUP_PATH"
echo " Using VM ID: $VIMID."
echo " Machine name: $MACHINE."
echo " Files in Machine folder: $I."
echo ""

echo "- Starting backup"
echo "-------------------------------"

echo " Creating snapshot..."
vim-cmd vmsvc/snapshot.create $VIMID tempbackupsnapshot
echo " Snapshot complete."
for A in $FILE_ARRAY
if [ -n "`echo \"$A\" | egrep '.vmdk|.nvram|.vmx'`" ] ; then
FILESIZE=$(stat -c%s "$A")
echo " Copying file: $A - Size: $FILESIZE bytes"
cp "$A" "$BACKUP_PATH"

echo " Skipping file: $A"



#Remove snapshot
echo " Removing snapshot..."
vim-cmd vmsvc/snapshot.removeall $VIMID
echo " Snapshot removed."

echo " Starting compression..."
echo " Compression complete."

echo " Removing backup temp..."
rm -rf "$BACKUP_PATH"
echo " Removed temp files."

echo ""
echo "-------------------------------"
echo " Backup Complete!"
echo "-------------------------------"

echo ""
echo ""
echo "-------------------------------"
echo " Error"
echo "-------------------------------"
echo " Folder $MACHINE_PATH or $BACKUP_ROOT does not exists"
#exit 1

Visit our advertisers

Quick Poll

Do you use GlusterFS in your workplace?

Visit our advertisers