Change UUID of VirtualBox Hard Disk vdi

While re-adding a deleted hard disk on my virtualbox server with same drive name, I got the following annoying 🙁 error “Failed to create the hard disk storage… Cannot register the hard disk… because a hard disk with UUID xxx already exists“.

vdi error

OK lets fix this:

– Open command prompt as Administrator, change directory to the install path ‘C:\Program Files\Oracle\VirtualBox’ (Might be different from your depending on where you installed the application), type in the following command:

VBoxManage.exe internalcommands sethduuid <Path to the new hard drive .vdi

vdi fix

Note: Both the ‘internalcommands‘ and ‘sethduuid‘ need to be lowercase

Ops!!! Hang on a minute, that didn’t fix the problem :(. I just tried adding the disk again with same name after deleting it from the folder but still having same error. That doesn’t make any sense.

OK what next:

– From command prompt again, enter the following command ‘VBoxManage.exe list hdds‘, see result below:


– Doesn’t make any sense, why is the disk appearing in the list even after deleting it and it’s showing state as ‘inaccessible‘. Yes of course it will, its not there anymore.

– OK I finally did some trick here with this command to delete the entry from the database – I’m loving this 🙂

VBoxManage.exe closemedium disk <uuid>’ where uuid is the id of the disk to be removed.

Note: Before adding the disk again after running the above command, ensure that the physical vdi file had been deleted.

comments powered by Disqus