ლ(ಠ益ಠლ)

VirtualBox: Cloning Virtual Disk - Cannot Register the Hard Disk

After manually migrating several virtual machine disks (.vmdk) to a new pool of storage, the following warning surfaced.

1
2
3
Failed to open the hard disk
Cannot register the hard disk '/path/to/image.vmdk' with UUID {UUID} because a hard 
disk '/old/path/to/image.vmdk' with UUID {UUID} already exists in the media registry.

For reference, the VBoxManage clonehd and/or closemedium function(s) should be used where possible.

VirtualBox assigns a unique identity number (UUID) to each disk image (which is also stored inside the image itself).

To update the virtual hard disk registry, one will need to use the VBoxManage internalcommands function called sethduuid (currently unsupported by Oracle):

1
2
3
4
5
6
7
8
9
$ VBoxManage internalcommands sethduuid

Usage: VBoxManage internalcommands <command> [command arguments]

Commands:

  sethduuid <filepath> [<uuid>]
       Assigns a new UUID to the given image file. This way, multiple copies
       of a container can be registered.

For instance:

1
2
$ VBoxManage internalcommands sethduuid /path/to/image.vmdk
UUID changed to: fb966da8-205a-45b1-bad8-62909ad5d060

You should now be able to attach the image to the virtual instance.

Comments