Minimizing a linux virtual disk image with zerofree
How to make your linux drive image smaller with zerofree and virtualbox-manage First you need to write zeroes on top of old unallocated data (the files you have deleted) on the virtual drive. This is done with zerofree. zerofree will only overwrite unallocated data so the Virtualbox drive image file will not get any bigger than it already is. Then we use vboxmanage to compact the virtual disk image. Note that this will not work if you are using an encrypted hard disk. This is because the zeroes written by zerofree will be encrypted. In that case, the virtual disk image will grow to it's full size. 1. Install zerofree First, install zerofree on your virtual machine: sudo apt install zerofree 2. Log in to recovery mode Log in to your machine in recovery mode. At startup, press shift to see GRUB menu. Select Advanced options and recovery mode for the newest kernel. Then select Root from the menu. Press enter when it asks you to "Press enter for maintenance". 3. Remount the d