Home FAQ Fix “hard disk with UUID already exists” Issue In VirtualBox
VBoxManage error cannot register the hard disk because a hard disk with UUID already exists

Fix “hard disk with UUID already exists” Issue In VirtualBox

By sk
177 Views

This quick tip will help to fix "hard disk with UUID already exists" issue in VirtualBox in Linux. Today, I tried to migrate one of my Virtualbox VM into KVM. I ran the following command to convert virtualbox VDI image to RAW format:

$ vboxmanage clonehd --format RAW /home/sk/VirtualBox\ VMs/CentOS\ 8\ Server/CentOS\ 8\ Server.vdi CentOS_8_Server.img

And I got this error:

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...
Progress state: NS_ERROR_INVALID_ARG
VBoxManage: error: Failed to clone medium
VBoxManage: error: Cannot register the hard disk '/home/sk/CentOS_8_Server.img' {894f84e2-dda6-41ab-aea6-387bc60e0fe4} because a hard disk '/home/sk/CentOS_8_Server.img' with UUID {afff3db8-b460-4f68-9c02-0f5d0d766c8e} already exists
VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component VirtualBoxWrap, interface IVirtualBox
VBoxManage: error: Context: "RTEXITCODE handleCloneMedium(HandlerArg*)" at line 1071 of file VBoxManageDisk.cpp

VBoxManage error Cannot register the hard disk. Because hard disk with UUID already exists

I deleted the old RAW image and tried to convert the virtual disk again, but still got the same error.

Fix "hard disk with UUID already exists" Issue In VirtualBox

After looked into VirtualBox forum, I found the actual cause to this problem. A few days ago I converted the same VDI virtual disk into RAW format using vboxmanage command and I deleted the virtual disk today without properly releasing it from Virtualbox media manager. So the Virtualbox box still thinks that there is an already registered virtual disk exits with the same UUID and refused to create a new one. To fix this, I should release and then remove the registered medium.

We can release and remove medium (hard disk or cdrom) in two ways:

  1. Using voxmanage command,
  2. Using Virtual media manager.

Release mediums with Vboxmanage command

To properly release the hard disk medium from command line, run this vboxmanage command:

$ vboxmanage closemedium disk afff3db8-b460-4f68-9c02-0f5d0d766c8e

Replace this "afff3db8-b460-4f68-9c02-0f5d0d766c8e" UUID with your actual disk's UUID. The UUID is given in the error message itself.

Release mediums with Virtual media manager

Open VirtualBox application and go to File -> Virtual Media Manager.

Open Virtual Media Manager In VirtualBox

From the Virtual Media Manager window, select the hard disk you want to remove and click "Remove" button from the menu bar.

Remove virtual disk from Virtual media manager

Close the Virtual media manager and Virtualbox main window. Now I can be able to convert the VDI virtual disk to RAW image without any problems.

Related read:

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More