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.

  • 1
    One doesn't need the "newUUID" paramenter. A new one will be generated automatically. Usage: VBoxManage internalcommands <command> [command arguments] and sethduuid <filepath> [<uuid>] – TJ. Jan 31 '13 at 9:55

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.