How to shrink OpenStack qcow2 image using qemu-img

shrink openstack qcow2 image
If you transfer qcow2 images very frequently across OpenStack Clouds or between KVM and Openstack environments, they can quickly grow larger. Luckily qcow2 image size can be decreased to reasonable values using qemu-img tool. Below we present how to shrink Openstack/KVM qcow2 image.

Examples:

Shrink qcow2 image without compression (larger file, short compression time):

[root@tuxfixer ~]# qemu-img convert -O qcow2 centos7.qcow2 centos7_small.qcow2

Shrink qcow2 image with compression (smaller file, long compression time):

[root@tuxfixer ~]# qemu-img convert -O qcow2 -c centos7.qcow2 centos7_small.qcow2
Liked it? Take a second to support tuxfixer.com on Patreon!

Share on: Share on FacebookShare on Google+Tweet about this on TwitterShare on StumbleUponShare on LinkedInPin on PinterestBuffer this pageShare on TumblrDigg thisFlattr the authorShare on RedditShare on VKShare on Yummly

Leave a Reply

Name *
Email *
Website