unix

How do I clone a Virtual Box image on my Linux server or desktop?

If you would like to clone a VirtualBox VDI file, you may get an error regarding having a duplicate UUID like the one in the example below.

[root@localhost]$ vboxmanage clonehd windows2003.vdi windows2003clone.vdi
VBoxManage: error: Cannot register the hard disk ‘/vmimages/windows2003.vdi’ {250a479c-47fa-463f-aec1-94436d1f974f} because a hard disk ‘/vmimages/windows2003clone.vdi’ with UUID {250a479c-47fa-463f-aec1-94436d1f974f} already exists
VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component VirtualBox, interface IVirtualBox, callee nsISupports
Context: “OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, AccessMode_ReadWrite, pMedium.asOutParam())” at line 209 of file VBoxManageDisk.cpp

Despite being in the directory that the files are located in, it’s a known issue that you need to supply the full path to the files. This is not mentioned in the help files, however, even after supplying the full path you still experience the same UUID issue.

[root@localhost]$ vboxmanage clonehd /vmimages/windows2003.vdi /vmimages/windows2003clone.vdi –existing
VBoxManage: error: Cannot register the hard disk ‘/vmimages/windows2003.vdi’ {250a479c-47fa-463f-aec1-94436d1f974f} because a hard disk ‘/vmimages/windows2003clone.vdi’ with UUID {250a479c-47fa-463f-aec1-94436d1f974f} already exists
VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component VirtualBox, interface IVirtualBox, callee nsISupports
Context: “OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, AccessMode_ReadWrite, pMedium.asOutParam())” at line 209 of file VBoxManageDisk.cpp

It turns out that using the UUID of the source file is required.

[root@localhost]$ vboxmanage clonehd 250a479c-47fa-463f-aec1-94436d1f974e /vmimages/windows2003clone.vdi
0%…10%…20%…30%…40%…50%…60%…70%…80%…90%…100%
Clone hard disk created in format ‘VDI’. UUID: c042c7b4-f7e9-4c1e-9641-14b4a7df2059

Click to comment

Leave a Reply

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

To Top