Reclaim storage space from qcow2 image after moving

After it is moved to another host, since it is a sparse file, the qcow2 takes the full space, e.g. if it was dynamically set to 100GB, it will take 100GB, even if only 50 GB were actually used.

I could get back more than 20 GB from my Win7 VM (from a 50 GB file) using this:

sudo qemu-img convert -O qcow2 win7.qcow2 win7_small.qcow2

Enjoy!

Source: http://www.tuxfixer.com/how-to-shrink-openstack-qcow2-image-with-qemu-img/

About SoCRaT

Systems Engineer, OSS & Linux Geek
This entry was posted in Linux, Uncategorized and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

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

Facebook photo

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

Connecting to %s