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

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

By sk
Published: Last Updated on 10.5K 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

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

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

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:

You May Also Like

4 comments

Daniel Hinostroza December 10, 2020 - 2:53 pm

In MacOS Big Sur it was because I had SIP disabled.

Reply
Martin May 30, 2021 - 4:10 pm

Thanks for your HowTo. In my case, my vagrant maschine needs the default virbr0 Interface for local connections. Therefore I couldn’t start any maschine, until I have recreated the default Interface.

Reply
sk May 30, 2021 - 5:35 pm

Glad I could help.

Reply
Denis June 7, 2022 - 7:32 pm

Thank you! Totally worked for me!

Reply

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. By using this site, we will assume that you're OK with it. Accept Read More