Change the UUID of a VHD

How can I change the UUID of a VHD-file?

My problem is that VirtualBox won't accept the VHD-file if it has already been added. But I am moving VHD disks between work/home and cloning them (and keeping them as VHD, not VDI) "at random".

The export/import feature won't work for me because 1) it changes the file to VDI and 2) it takes too damn long, can't wait for it to export+import a 60GB disk every morning/afternoon when I switch locations.

It is important to keep it as VHD so its compatible with HyperV.


VBoxManage internalcommands sethduuid "filename" "newUUID"

Type VBoxManage internalcommands to see the other less documented features available.


You can do two things:

1) The storage manager keeps track of where the files are, but not necessarily the files themselves. If you just replace the file on disk (rather than import/export) things should "just work"™ - if you are taking the virtual disks between computers, just copy them over the top of the existing files.

2) If you absolutely need to change the UUID for whatever reason you can run the following command to clone the VHD, which will give it a new UUID:

VBoxManage clonehd source.vhd destination.vhd

You should be able to import the cloned drive and assign it to a machine as you normally would. Here is the relevant info for the clonehd command: http://www.virtualbox.org/manual/ch08.html#vboxmanage-clonevdi