If it’s a variable-size virtual disk, the file increases size as the disk becomes full, but the file doesn’t automatically shrink when the disk is emptied.

  1. zero free space on virtual disk
    • on win guest:
      • defragment disk: defrag c: /u /v
      • sdelete -z c: # sysinternals
    • on linux guest:
      • dd if=/dev/zero of=/var/tmp/anyname bs=1G
      • rm /var/tmp/anyname
  2. turn off guest
  3. compact vdi file
    • VBoxManage modifymedium <DISK-UUID> –compact