Cloning VirtualBox virtual disk images

Well, you learn something new everyday.

I thought that cloning VirtualBox virtual disk image was a simple matter of copying them over to another file. Apparently that's not the case. cp does copy the file, but you won't be able to use it.

You won't see the problem until you try to create a new virtual machine using the copied VDI as the disk. Then VirtualBox will complain that the VDI UUID is already in use.

The way to get around this is to use VBoxManage, a VirtualBox general utility that provides tools beyond what's given in the VirtualBox GUI.

To clone a VDI:

VBoxManage clonevdi mysourcedisk.vdi mydestinationdisk.vdi

Takes a while to clone, but really no longer than a simple cp