Start VM and fill free space with zeros:

$ sudo dd if=/dev/zero of /zeros bs=1M

Stop VM and from host, locate VM disk image:

$ VBoxManage showvminfo VM_NAME | grep vdi

And finally:

$ VBoxManage modifyhd --compact "PATH-TO-FILE.vdi"

References

  • http://www.netreliant.com/news/8/17/Compacting-VirtualBox-Disk-Images-Linux-Guests.html


blog comments powered by Disqus