Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ingmarioalberto/807d723274c72c1015050564f4b45206 to your computer and use it in GitHub Desktop.
Save ingmarioalberto/807d723274c72c1015050564f4b45206 to your computer and use it in GitHub Desktop.
shrink a virtualbox disk guest to free space on host
1. Verify it is a Dynamic Disk || convert it to dynamic
2. zerotise empty space:
windows guest: (tested)
2.1 download sdelete.exe (https://docs.microsoft.com/en-us/sysinternals/downloads/sdelete)
2.2 as administrator, run: sdelete.exe c: -z
linux guest: (untested)
2.1 install zerofree
2.2 reboot into recovery mode
2.3 drop to root shell
2.4 zerofree -v /dev/sdXY
3. VBoxManage modifymedium disk "/PATH/TO/disk.vdi" --compact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment