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:
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.
We make sure the clone gets a new MAC address too.
And we use the “Full Clone” type.
Then we check, where the clones’ image file has been saved. The default location is:
C:\Users\Your user name\VirtualBox VMs
Then copy the cloned image file to a new location, f.i. the Desktop.
And make sure the VDI-image-clone is deleted. Right-click the virtual machine:
And choose “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
Afterwards we can add a new guest machine to VirtualBox and use the VHD file as image file:
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