Compact vbox disk

Compact vbox disk

  • run defrag in the guest (Windows)

  • nullify free space:
    With Linux guest run this:

    1
    2
    sudo dd if=/dev/zero of=/bigemptyfile bs=4096k
    sudo rm -rf /bigemptyfile

    With Windows guest, download SysinternalsSuite and run this:

    1
    sdelete –z
  • shutdown the guest VM

  • now run VBoxManage’s compact command

    1
    VBoxManage.exe modifyhd thedisk.vdi --compact