Skip to content

Instantly share code, notes, and snippets.

@guumaster
Last active December 18, 2015 00:09
Show Gist options
  • Save guumaster/5694322 to your computer and use it in GitHub Desktop.
Save guumaster/5694322 to your computer and use it in GitHub Desktop.
Reduce VirtualBox VDI image size.
1. Install zerofree program:
sudo apt-get install zerofree
2. Reboot Ubuntu.
3. Press <Shift> to enter grub menu.
4. From grub menu select "recovery mode".
5. Select "root" from Recovery Menu.
6. Check to see disk names:
df
7. Mount the disk as read only:
mount -n -o remount,ro -t ext2 /dev/sda1 /
8. Make zeros:
zerofree /dev/sda1
9. Shutdown Ubuntu:
halt
10. From Windows host execute:
"VirtualBox\VBoxManage" modifyhd <disk_name>.vdi compact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment