VirtualBox: Failed to delete the storage unit of the hard disk /PATH/HARD-DISK.vdi. Cannot close medium ‘/PATH/HARD-DISK.vdi’ because it has N child media.

After upgrading to VirtualBox 4.3.2 r90405, I get this dreaded error message when running VirtualBox:-

One or more virtual hard disks, CD/DVD or floppy disk image files are not 
currently accessible. As a result, you will not be able to operate virtual 
machines that use these files until they become accessible later.
Press Check to open the Virtual Media Manager window and see which files 
are inaccessible, or press Ignore to ignore this message.

I was able to clone the offending VDI and boot from the cloned VDI without losing any data. The cloning process took about half hour.

Now, when I try to remove the offending VDI under Virtual Media Manager, I get the following error message:-

Failed to delete the storage unit of the hard disk 
/Users/theUser/Library/VirtualBox/HardDisks/Windows.vdi.
Cannot close medium '/Users/theUser/Library/VirtualBox/HardDisks/Windows.vdi' 
because it has 2 child media.

So, I ran the following command on the Terminal:-

VBoxManage list hdds

… and these are the results I see:-

UUID:           8c688dc1-0ec3-4528-82b8-efd78a24277e
Parent UUID:    base
State:          created
Type:           normal (base)
Location:       /Users/theUser/Library/VirtualBox/HardDisks/Windows.vdi
Storage format: VDI
Capacity:       51200 MBytes

UUID:           7ef3723f-e960-4e68-9b8c-ef8d65b1474b
Parent UUID:    8c688dc1-0ec3-4528-82b8-efd78a24277e
State:          inaccessible
Type:           normal (differencing)
Location:       /Users/theUser/Library/VirtualBox/Machines/Windows 7 64/Snapshots/{7ef3723f-e960-4e68-9b8c-ef8d65b1474b}.vdi
Storage format: VDI
Capacity:       0 MBytes

UUID:           633a54a5-c3c0-4330-b371-9d448ae28c4c
Parent UUID:    8c688dc1-0ec3-4528-82b8-efd78a24277e
State:          inaccessible
Type:           normal (differencing)
Location:       /Users/theUser/Library/VirtualBox/Machines/Windows 7 64/Snapshots/{633a54a5-c3c0-4330-b371-9d448ae28c4c}.vdi
Storage format: VDI
Capacity:       0 MBytes

UUID:           7375877a-0e16-4803-a972-ac4e84f71a4b
Parent UUID:    base
State:          created
Type:           normal (base)
Location:       /Users/theUser/Library/VirtualBox/HardDisks/Ubuntu 32.vdi
Storage format: VDI
Capacity:       8192 MBytes

UUID:           70a8d322-a207-4e56-afc3-50fbaa97593e
Parent UUID:    base
State:          created
Type:           normal (base)
Location:       /Users/theUser/VirtualBox VMs/Ubuntu 64 Clone/Ubuntu 64 Clone.vdi
Storage format: VDI
Capacity:       10240 MBytes

UUID:           6d655fd9-362b-4ae6-b2ad-2be61582aa72
Parent UUID:    base
State:          created
Type:           normal (base)
Location:       /Users/theUser/VirtualBox VMs/Ubuntu 12.04 LTS - 64bit/Ubuntu 12.04 LTS - 64bit.vdi
Storage format: VDI
Capacity:       10240 MBytes

UUID:           1ff0ee93-bdf0-4162-ad50-636bbc8870cf
Parent UUID:    base
State:          created
Type:           normal (base)
Location:       /Users/theUser/VirtualBox VMs/Centos 64/Centos 64.vdi
Storage format: VDI
Capacity:       10240 MBytes

UUID:           190349ca-ce6d-4f95-bf65-f378f476c403
Parent UUID:    base
State:          created
Type:           normal (base)
Location:       /Users/theUser/VirtualBox VMs/Windows 7/Windows 7-disk1.vdi
Storage format: VDI
Capacity:       51200 MBytes

The highlighted rows are the offending VDIs that I tried to remove. After checking the file system, both Windows 7 snapshots no longer exist but VirtualBox still keeps track of them in VirtualBox.xml.

Using the UUIDs, I remove both snapshots first:-

VBoxManage closemedium disk 633a54a5-c3c0-4330-b371-9d448ae28c4c
VBoxManage closemedium disk 7ef3723f-e960-4e68-9b8c-ef8d65b1474b

Then, I remove the offending parent VDI:-

VBoxManage closemedium disk 8c688dc1-0ec3-4528-82b8-efd78a24277e

Now, when I rerun VirtualBox again, the error message does not appear anymore

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s