This post demonstrates bash
zerofree to shrink virtual box disk image
Our goal is to remove unused space from a virtual box disk image file (vdi)
Boot the recovery root console and list all partitions. Remount and zerofree the device which you wan’t to shrink:
/dev/sdx1 with your disk partition f.e.