How to delete unremovable disk images in VirtualBox

It is possible to remove a seemingly unremovable ISO in Oracle's Virtual Box, if you follow these steps.

So you just finished an operating system install within VirtualBox that you plan to use for testing purposes. After setting up the virtual machine, you get the guest operating system booted up and you mount an ISO image to the virtual disc drive for further examination. Meanwhile, it would seem prudent for you to create a snapshot of your virtual machine (VM) in the exact state it is in, in case something should go wrong. Once a VM snapshot is made within VirtualBox, you turn the VM off and delete the ISO, knowing that it no longer serves a purpose and you want to save disk space. Unfortunately, you get an error message (Figure A) the next time you fire up VirtualBox.

Figure A

You encounter the VirtualBox error message.
Clicking the Check button takes you to the Virtual Media Manager dialog box (Figure B), and under the CD/DVD Images tab, you discover that, despite your efforts to remove the recently deleted ISO from the list, the Remove button is greyed out and unable to be used. In other words, you can't exactly resolve this issue right off the bat.

Figure B

Locate the problem in the Virtual Media Manager dialog box.

The reason for this anomaly is because the disc image is mounted within a VM and is being recognized by a snapshot. Until this snapshot is removed with the associated VM, the discrepancy refuses to clear and you are unable to remove the ISO file from the images list. Here is a recommended procedure to quickly resolve this issue. This guide applies also to floppy and hard disk images as well.

A slideshow version of this blog post is available as a TechRepublic Photo Gallery.

Remove the ISO

First, click the name of the virtual machine that used the ISO file in question (Figure C), click the Snapshots button on the right-hand side, and then restore the snapshot you recently created by clicking the snapshot name and pressing Ctrl+Shift+R. When prompted, uncheck the checkbox for Create a Snapshot of the Current Machine State before you click the Restore button.

Figure C

Click the problem VM.
Once the guest operating system is restored and actively running, ensure that no documents or other applications are open and then proceed to shut down the virtual machine normally via the guest operating system's Shut Down menu or button (Figure D).

Figure D

Shut it down.
After the guest environment closes out and exits gracefully, return to the virtual machine snapshots area, select the snapshot in question, and then press Ctrl+Shift+D. A dialog box will appear (Figure E), asking you to confirm your action. Press Delete to finish the job once and for all.

Figure E

Yes, I want to delete.
Now, return to the Virtual Media Manager by pressing Ctrl+D, select the CD/DVD Images tab once more, then select the missing image file within the list, and click the Remove button at the top of the window. When prompted to confirm (Figure F), click Remove to delete the image listing.

Figure F

Confirm the removal.

And there you have it. VirtualBox will no longer nag you about an image file in Virtual Media Manager that you deleted. If anyone has any other interesting tricks for dealing with image files in VirtualBox, please opine in the comments section below.

Also read: