kvm | linux | shrink sparse disk using zerofree

Install zerofree

edit your fstab, set your root drive to RO like

/dev/vda1 / ext2 ro 0 1

Halt your system

 # halt -p

Start your system into the grub menu, then select rescue mode, then drop to root shell

Run zerofree like

 # zerofree /dev/vda1

Remount your root drive RW

 # mount -o remount,rw /dev/vda1

Re-edit your fstab to his origins to mount root drive RW after reboot.

Reboot

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.