====== KVM - Compressão de imagens ======
$ sudo apt install libguestfs-tools
$ qemu-img convert -O qcow2 /home/gean/kvm/images/EVE.qcow2 eve-small.qcow2
$ qemu-img info eve-small.qcow2
image: eve-small.qcow2
file format: qcow2
virtual size: 64 GiB (68719476736 bytes)
disk size: 35.3 GiB
cluster_size: 65536
Format specific information:
compat: 1.1
compression type: zlib
lazy refcounts: false
refcount bits: 16
corrupt: false
extended l2: false
$ sudo virt-sparsify --in-place eve-small.qcow2
$ qemu-img info eve-small.qcow2
image: eve-small.qcow2
file format: qcow2
virtual size: 64 GiB (68719476736 bytes)
disk size: 12 GiB
cluster_size: 65536
Format specific information:
compat: 1.1
compression type: zlib
lazy refcounts: false
refcount bits: 16
corrupt: false
extended l2: false
$ qemu-img convert -O qcow2 -c eve-small.qcow2 eve.qcow2
$ qemu-img info eve.qcow2
image: eve.qcow2
file format: qcow2
virtual size: 64 GiB (68719476736 bytes)
disk size: 5.81 GiB
cluster_size: 65536
Format specific information:
compat: 1.1
compression type: zlib
lazy refcounts: false
refcount bits: 16
corrupt: false
extended l2: false
Referências
- [[https://tuxfixer.com/how-to-shrink-openstack-qcow2-image-with-qemu-img/|How to shrink OpenStack qcow2 image using qemu-img]]
- [[https://linuxconfig.org/how-to-resize-a-qcow2-disk-image-on-linux|How to resize a qcow2 disk image on Linux]]
- [[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/virt-sparsify|21.14. virt-sparsify: Reclaiming Empty Disk Space]]