Is it safe to delete the VirtualBox VMs folder?
- Yes, VM by VM, from VirtualBox. Each folder in
~/VirtualBox VMsis one virtual machine: its settings file, its virtual disks and its snapshots. Removing a VM with its files deletes the guest system and everything saved in it. - What it costs you: the whole guest. Deleting folders in Finder instead leaves VirtualBox listing a machine whose files are gone, so remove VMs in VirtualBox Manager or with
VBoxManage. - Does it come back? No. Copy or export a VM first if you might need it again.
- SiftMac’s verdict: You decide
1. What it is
VirtualBox gives every virtual machine a folder of its own, which Oracle’s manual calls the VM folder. By default they all sit together in a folder called VirtualBox VMs in your home folder. A VM folder holds:
<name>.vbox: the VM’s settings, an XML file.- Its virtual disk images, typically
.vdifiles, with the guest’s operating system and files. Usually the biggest part. Snapshots/, if you’ve taken snapshots: the extra disk images and saved states each one needs.Logs/: VirtualBox’s logs for that VM.
VirtualBox’s global settings, including the list of VMs it knows about, are kept apart from all of this, in ~/Library/VirtualBox.
2. Where it is
~/VirtualBox VMs
You can change the default with the Default Machine Folder setting in VirtualBox Manager’s preferences, or with VBoxManage setproperty machinefolder, and any single VM can live somewhere else. VBoxManage list vms lists every registered VM with its name and UUID.
3. How big it gets
Dynamically allocated disks start small and grow as the guest writes, but they don’t shrink by themselves when the guest deletes files, and every snapshot adds another disk image on top. To see each VM’s folder, biggest last:
du -sh ~/VirtualBox\ VMs/* | sort -h
VBoxManage list vms
4. How to delete it safely
- Shut the VM down: VirtualBox disables Remove while a VM is running.
- In VirtualBox Manager, click Machines, then Control-click the VM in the machine list and choose Remove.
- In the dialog, choose to remove the VM’s files as well, not just its entry in the list.
From Terminal, VBoxManage does the same in one step:
VBoxManage unregistervm "<VM name>" --delete
With --delete, VirtualBox deletes the VM’s hard disk images, differencing images included, its saved state files, one for each snapshot, its settings file and backups, its logs, and its folder once it’s empty. --delete-all also deletes DVD and floppy images in the VM’s folder that are attached only to this VM.
To keep a VM but shrink its disk, first delete snapshots you no longer need in the VM’s Snapshots tab; Oracle notes this can take a long time and needs temporary disk space while it runs. Then zero out the free space inside the guest, shut the VM down and compact the disk:
VBoxManage modifymedium disk "<path to disk>.vdi" --compact
Compacting removes blocks that contain only zeroes, so it only frees what the guest has zeroed, with tools Oracle names such as sdelete -z in Windows or zerofree for Linux ext2 and ext3 file systems. It works on VDI images only.
5. What happens afterwards
- A VM removed with its files is gone from VirtualBox and from your disk.
- A VM removed from the list only keeps its folder, and all its space, where it was.
- Folders on your Mac that you shared with the guest aren’t part of the VM folder, so they’re untouched.
- After compacting, the VM starts as before with a smaller disk image on your Mac; the disk’s size inside the guest doesn’t change.
Questions
What happens if I delete a VM folder in Finder?
The files go, but VirtualBox keeps the VM in its list, pointing at files that no longer exist. Remove it in VirtualBox Manager afterwards, or better, remove it there in the first place.
Is ~/Library/VirtualBox safe to delete?
Not while you use VirtualBox. It holds VirtualBox’s global settings and its list of registered VMs. The space is in VirtualBox VMs, not here.
Why doesn’t my VM get smaller after deleting files in the guest?
A dynamically allocated disk doesn’t shrink by itself. Zero the free space inside the guest, shut it down and run VBoxManage modifymedium disk … --compact.
Does removing a VM delete its installer ISO?
Only with --delete-all, and only for images in the VM’s own folder that no other VM uses. ISOs kept anywhere else stay.
How SiftMac handles it. SiftMac doesn’t list or remove virtual machines; their contents are yours. Its space map shows ~/VirtualBox VMs folder by folder, with each VM’s size and a Show in Finder button, so you can spot the big ones and remove them in VirtualBox.
Download SiftMac · scanning is free, and so is your first 2 GB of cleaning · See how it works