When you delete files in your virtualbox VM in order to free up space on the host filesystem, this space is not automatically reclaimed.
In order for the host system to see the changes you need to rewrite the free space with zeroes.
Follow the below steps to perform this operation:
- Install
zerofreepackage. It is needed to rewrite the free space with zeroes. - Mount the filesystem as "readonly". This is needed for the tool to be able to perform it's task. If you're working with the "/", easiest way to mount it as readonly is to edit the kernel parameters.
- Edit
/etc/default/grub. - Find the
GRUB_CMDLINE_LINUX_DEFAULTline. - Add
init=/bin/bashto it - reboot
- Edit
- Run
zerofree -v /dev/sdX. This could run for some time, depending on the size of your disk. - After it's done, run
exec initto finish booting up. - Shutdown the VM in order to be able to run the next command which requires a lock on the VDI volume.
- On the Windows host run
VBoxManage.exe modifymedium "path\to\disk.vdi" --compact
Top comments (0)