VMware ESXi and vSphere Cluster Management
How to Remove a Virtual Machine in Oracle VirtualBox
Learn how to remove a VM from Oracle VirtualBox by unregistering it from VirtualBox Manager or deleting its associated files permanently.
What Removing a Virtual Machine Means
Oracle VirtualBox is a desktop virtualization platform for creating and running virtual machines. A virtual machine (VM) is a software-defined computer that runs a guest operating system using resources from the physical host computer.
When you remove a VM, VirtualBox gives you two different choices:
- Remove the VM from the VirtualBox Manager machine list while retaining its files. This is also called unregistering the VM.
- Remove the VM from the list and delete its associated files from the host computer.
Associated files can include the VM configuration, virtual disks, snapshots, logs, and saved-state data. A virtual disk is a host file that acts as the guest operating system's hard drive.
When You Might Remove a VM
- Free disk space consumed by an obsolete VM.
- Clean up temporary test or lab systems.
- Remove duplicate or outdated entries from VirtualBox Manager.
- Retain a VM's files for backup, migration, or later re-registration without keeping it in the current machine list.
Unregistering Versus Deleting Files
| Option | Effect in VirtualBox Manager | Effect on VM Files | Best Used When | Recovery Considerations |
|---|---|---|---|---|
| Remove from machine list only | The VM entry disappears from VirtualBox Manager. | The configuration, virtual disks, snapshots, and other retained files remain on the host. | You want a backup, plan to move the VM, want to manage its files manually, or may register it again later. | The files can generally be added or registered again later if they remain intact and you know their location. |
| Delete associated files | The VM entry disappears from VirtualBox Manager. | VirtualBox deletes the VM's associated host files, including files such as virtual disks and snapshots when they are stored with the VM. | The VM is disposable, no guest data is needed, and reclaiming storage is the goal. | Recovery may not be possible without a separate backup. |
Requirements Before Removal
The target VM must not be running. A VM that is powered off is not currently running and can be removed. If the guest is active, the Remove action may be unavailable or unsuitable.
Shut Down the Guest Normally
Whenever possible, shut down the guest operating system from inside the VM using its normal shutdown command. This allows the guest to close applications and write pending data safely. Wait until VirtualBox shows that the VM is powered off.
Power Off When Appropriate
If the guest operating system is frozen or cannot shut down normally, use VirtualBox's power-off action when appropriate. Powering off is similar to removing power from a physical computer and can cause data loss or filesystem damage inside the guest. Do not use it as the routine shutdown method.
Confirm the Target and Its Data
Before opening the removal dialog, verify the VM name and inspect its details. Similar names can make it easy to select the wrong machine. If you intend to retain the files, note the VM folder location. If you intend to delete them, confirm that important guest data, snapshots, and reusable virtual disks are backed up or no longer needed.
| Check | Why It Matters |
|---|---|
| VM is powered off | Removal is intended for a non-running machine, and the Remove action may be unavailable while the VM is active. |
| Correct VM is selected | Prevent deleting or unregistering a similarly named VM by mistake. |
| Important guest data is backed up | Permanent file deletion may not be reversible. |
| Removal choice is understood | Unregistering retains files; deleting associated files removes them from the host. |
| Available host storage needs are considered | List-only removal does not reclaim the space occupied by retained virtual disks. |
Remove a VM Through VirtualBox Manager
- Open VirtualBox Manager, the graphical interface used to view, configure, start, and manage VMs.
- Locate the intended VM in the machine list.
- Select the VM and verify its name and state. It must be powered off.
- Right-click the selected VM.
- Choose Remove from the context menu.
- Read the confirmation dialog carefully.
- Choose the option that retains the files or the option that deletes the associated files.
- Confirm the action only after checking that the selected VM and removal outcome are correct.
Retain the Files and Remove Only the List Entry
Choose the list-only removal option when you want the VM to disappear from VirtualBox Manager but want to keep its data on the host. This is useful for keeping a backup, moving the VM to another location, managing it manually, or registering it again later.
For example, to clean up an obsolete test VM while keeping a backup, shut down the test VM, right-click it in VirtualBox Manager, choose Remove, and select the option that removes it from the machine list without deleting its files. The VM entry disappears, but its folder and virtual disks remain available on the host.
Note the retained folder location before removal. You can later use the retained VM files for restoration or migration, provided they have not been moved, modified, or deleted.
Delete the VM and Its Associated Files
Choose the file-deletion option only when the VM is no longer needed and you want to reclaim its host storage. VirtualBox removes the machine-list entry and deletes the associated data selected by the operation, which can include configuration files, virtual disks, snapshots, logs, and saved-state files.
For a disposable lab VM, first confirm that it contains no required guest files or snapshots. Ensure that it is powered off, choose Remove, select the option to delete associated files, and confirm. The VM entry and its related host files are then removed.
Post-Removal Verification
- Check the VirtualBox Manager machine list and confirm that the VM no longer appears.
- If you retained the files, check the expected host folder and confirm that the VM data is still present.
- If you deleted the files, inspect the expected host storage location and confirm that the VM directory or associated files are no longer there.
- If storage space was not reclaimed after list-only removal, remember that the virtual disks and other retained files still occupy space. Decide whether to preserve, move, back up, or delete them after confirming they are not needed.
Troubleshooting
The Remove Action Is Disabled
The VM is probably running. Shut down the guest operating system normally, or power off the VM if normal shutdown is not possible. Return to VirtualBox Manager and try the Remove action again.
You Are Unsure Whether Deleting Files Is Safe
The VM may contain important guest data, snapshots, or reusable virtual disks. Make a backup and choose list-only removal until permanent deletion is confirmed. Retaining the files removes the entry from the manager without immediately removing the underlying data.
The VM Disappeared but Disk Space Was Not Reclaimed
The list-only option was probably selected. Locate the retained VM folder and inspect its virtual disks, snapshots, and other files. Preserve or move them if they are needed; delete them only after confirming that the VM and its data are no longer required.
The Wrong VM Was Selected
Similar VM names or insufficient verification can cause an incorrect selection. Cancel the confirmation dialog if anything looks wrong. Use clear VM names, inspect the selected machine's details, and verify the target before confirming future removal operations.
Exam-Relevant Notes
- Remove is the VirtualBox action that removes a selected VM from the manager and then offers a choice about its files.
- Unregister means removing the VM's registration while retaining the underlying machine files on the host.
- Removing a VM from the list is not the same as deleting its virtual disks.
- A running VM must be shut down or powered off before removal.
- Deleting associated files can permanently remove virtual disks, snapshots, and other VM data.