2.) Boot to safe mode (recovery mode) where you can access your root partition (/dev/sda1).
3.) Mount the root partition as read-only (mount -o ro /dev/sda1 /mnt/tmp)
4.) Run “zerofree /dev/sda1″
5.) Shutdown the virtual machine and run “VBoxManage modifyhd –compact /path/to/virtualboximage.vdi”
http://maketecheasier.com/shrink-your-virtualbox-vm/2009/04/06 — Keep in mind that zerofree does in fact support ext4 (I think this article is a tiny bit dated, but it’s a great one).