In order to recover diskspace on your VirtualBox host machine it is necessary to zero out the unused portion of VirtualBox disks.
Follow these steps to get the job done.
install zerofree
sudo apt install zerofree
reboot into ubuntu recovery console, hold down [RIGHT SHIFT]
advanced options -> recovery mode -> root console
find the root directory
mount | grep "sda"
run zerofree
echo "u" > /proc/sysrq-trigger
mount /dev/mapper / -o remount,ro
zerofree -v /dev/sda1
shutdown
shutdown -h now
compress the drive
VBoxManage modifyhd /path/to/VDI/VM.vdi --compact
source: cyplex from ubuntuforums.org
References:
https://askubuntu.com/questions/1092812/zerofree-on-ubuntu-18-04