Clone VirtualBox images (.vdi)

Just copying a VirtualBox .vdi file and the opening it results in the error:

Cannot register the hard disk ‘myhd.vdi’ with UUID {ABCD} because a hard disk ‘myhd2.vdi’ with UUID {ABCD} already exists in the media registry (‘path/VirtualBox.xml’).

The solution is to generate a new UUID for the copy. This is done using:

VBoxManage internalcommands setvdiuuid myhd2.vdi