VirtualBox – Cannot Register the Hard Drive Because a Hard Disk With UUID Already Exists

I frequently use virtualization to run a Linux instance within my Windows instance. It provides a whole host of benefits and is really a wonderful thing, I can’t explain how great it is to seamlessly move between different operating systems. But that’s when it works… Today I was attempting to move my Linux virtual hard drive off my SSDs and onto my portable hard drive when I received an error that said I could not register the hard drive because a hard drive with UUID already exists. Bummer, right? So off I went to Google and after a little digging I found out that isn’t difficult to fix this issue, just a couple quick commands is all you need:

  1. Open up the Command Prompt (cmd.exe) by searching for it in the Windows search box or pressing the Windows Key + R and typing “cmd”
  2. Change to the directory where VirtualBox is installed. For example mine was installed in “C:\Program Files\Oracle\VirtualBox”, so I did:
    cd C:\Program Files\Oracle\VirtualBox
  3. Run the following command, replacing with the path to wherever your new copy of the hard drive is:
    VBoxManage.exe internalcommands sethduuid "<path to hd>"

That’s it! After that, you should be able to add the hard drive to your system without any issue.