Convert VDI to VHD images

Before cloning an existing VDI we need to make sure the VDI isn’t registered and used anymore. Otherwise VBoxManage, the tool that is used to clone the image, will report an error:

01-UUID-exists

VBoxManage.exe: error: Cannot register the hard disk'C:\Users\VBoxUser\Desktop\FreeDOS1.1net.vdi' {fc24f618-53d6-4e37-b2ca-11dceccdab53} because a hard disk 'C:\Users\VBoxUser\Documents\VirtualBox\FreeDOS1.1net.vdi' with UUID {fc24f618-53d6-4e37-b2ca-11dceccdab53} already exists

To make sure no existing image is used, we clone an VDI image. In our example, it is the FreeDOS1.1net.vdi.

02-clone-image

We make sure the clone gets a new MAC address too.

03-new-MAC

And we use the “Full Clone” type.

04-full-clone

Then we check, where the clones’ image file has been saved. The default location is:

C:\Users\Your user name\VirtualBox VMs

05-check-location

Then copy the cloned image file to a new location, f.i. the Desktop.

06-copy-to-desktop

And make sure the VDI-image-clone is deleted. Right-click the virtual machine:

07-remove-clone-vdi

And choose “Delete all files”.

08-delete-all-files

Now in our example we renamed the clone on the desktop to FreeDOS1.1net.vdi and clone it to FreeDOS1.1net.vhd.

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" clonehd FreeDOS1.1net.vdi FreeDOS1.1net.vhd --format VHD

09-VBoxManage-clonehd

Afterwards we can add a new guest machine to VirtualBox and use the VHD file as image file:

10-Use-VHD-disk

The procedure for Mac users is mostly the same, only the VBoxManage line is a bit different:

vboxmanage clonehd FreeDOS1.1net.vdi FreeDOS1.1net.vhd --format VHD

 

Ulrich Hansen