Last active
August 25, 2016 16:07
-
-
Save atmin/6807052 to your computer and use it in GitHub Desktop.
Compact dynamically expanding VirtualBox CentOS image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Delete unnecessary files from image | |
2. sudo yum install zerofree | |
3. reboot, edit kernel parameters, add 'rescue single ro' | |
4. remount root read-only: | |
sudo mount -r -o remount /dev/mapper/vg_centos6generic-lv_root | |
5. null the free space (-v = verbose, -n = dry run): | |
sudo zerofree -v /dev/mapper/vg_centos6generic-lv_root | |
6. turn off VM | |
7 from host OS: | |
vboxmanage modifyhd --compact MachineDisk.vdi | |
Was able to shrink 50GB image to 36GB with only 366MB free space on the host machine. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍