Like many Xojo developers, I often use virtual machines for testing. Over time the virtual machine disk files can get pretty large, even if you delete stuff from within the VM regularly.
I primarily use VMware Fusion, which lets you shrink the VM disk files if you have a Windows VM. Do this by going to the VM’s General settings in Fusion and click Clean Up Virtual Machine. This will shrink the size of the VM to the actual amount of disk spaces being used by removing the space marked as Reclaimable.
This is useful and I do it regularly for VMs that are on my SSD where space is precious.
However, I also happen to use a lot of Linux VMs, where the option to “Clean Up” is not available to shrink disk size.
Fortunately, you can accomplish the same thing from the Terminal inside the Linux VM.
In my case I am using Linux Mint 20. Here are the steps:
- Open a Terminal window.
- Type this command:
- sudo vmware-toolbox-cmd disk shrink /
- There is no step 3.
Now you just wait. When it finishes you may want to restart the VM, but that does not appear to be a requirement.
In my case, my Mint VM went from 110GB down to 58GB, a savings of 52GB (!) which is not insignificant on most SSDs. The VMware Tools Configuration Utility Guide has more details on what other commands are available.