How to Delete a Virtual Machine from VirtualBox

Finished with a virtual machine and you want to delete it from VirtualBox? Maybe you setup a VM you no longer need, or cloned an OS VM and want to remove it, or perhaps you’re simply aiming to free up disk space by removing virtual machines from VirtualBox, whatever the reason it’s a simple process to delete a virtual machine from VirtualBox.

The instructions we’ll cover here work for completely removing an OS and deleting the associated virtual machine from within VirtualBox on Mac OS, Windows, and Linux. We’ll also show you how to delete a virtual machine from VirtualBox by using the command line.

How to Completely Remove an OS and Delete a Virtual Machine in VirtualBox

To completely delete any virtual machine from VirtualBox on Mac, Windows, or Linux, simply do the following:

  1. Open VirtualBox and go to the VM VirtualBox Manager screen
  2. Select the virtual machine and OS you want to delete (quit the VM if it’s currently active first)
  3. Right-click on the virtual machine name in the list and choose “Remove”, or optionally pull down the “Machine” menu and choose “Remove”
  4. How to delete a virtual machine in VirtualBox

  5. To completely delete the operating system and virtual machine from VirtualBox, choose “Delete all files” *
  6. How to delete a virtual machine from VirtualBox

  7. Repeat with other virtual machines to delete them as needed

* If you choose “Remove only” than the virtual machine is simply removed from the VirtualBox VM manager, but none of the actual files or associated VM, OS, VDI, or anything else is deleted. Thus if you actually want to delete the VM and associated files, choose ‘Delete all files’

How to Delete a Virtual Machine from VirtualBox by Command Line

If you prefer to use the command line, you can also completely delete a virtual machine from VirtualBox from a terminal. To use this approach, launch the command line (Terminal in MacOS) and then use the VBoxManage command tool with the following syntax: (note the flag –delete has two dashes)

VBoxManage unregistervm --delete "Name of Virtual Machine"

Deleting a VM from VirtualBox by command line is very thorough and removes all associated virtual hard disk image files, saved states, xml files, backups, VM logs, and all associated directories with the target VM to delete.

It doesn’t really matter if you delete the virtual machine from the command line or from the VirtualBox application directly, both get the job done.

Deleting a virtual machine from VirtualBox will free up any storage space that was taken up by that VM and associated OS, including the associated VDI, VMDK, VHD or HDD files. Because virtual machines can be quite large, this is often many gigabytes in size.

Note this is aimed at deleting a virtual machine within VirtualBox but otherwise preserving other VMs and VirtualBox itself, it’s not attempting to remove or uninstall VirtualBox as an application though you can of course do that if needed too with these instructions.

Virtual machines offer an easy way to run multiple operating systems at the same time, which is why they’re frequently used in development environments for testing with various operating systems. This particular article is obviously focused on VirtualBox, but there are other VM software packages available too including VMWare and Parallels.

VirtualBox is particularly appealing to many users not only because it’s powerful and cross platform compatible able to run on Mac, Windows, and Linux, but also because it’s free. VirtualBox can do everything from run Windows 10 in a VM all the way back to old versions of Windows with old Internet Explorer versions, or Ubuntu Linux or another Linux distribution or unix flavor, and even Mac OS X (though if you want to virtualize MacOS it’s easier to do so with Parallels) and other operating systems too.

If the general topic of virtualization appeals to you, check out our other virtual machine posts here where you can find tons of tutorials on running a wide range of operating systems in VirtualBox.

Source: OSX Daily