Hello. I have a qcow2 image with RHEL installed for creating a demo. The image size is 12 GB but the internal filesystem is using only 11 GB, so this image has 11 GB unused. For shrinking, I'm using "qemu-img convert" from qcow2 to qcow2 (noop) and the images shrinks correctly to 1 GB. This image has a internal snapshot taken with virt-manager. After converting the image, the snapshot is lost. I often use this snapshot capability and I want to know if is any way for shrinking the image without losing the internal snapshots. I tried virt-sparsify too, with the same result, because it internally uses "qemu-img convert".
Lot of thanks. I attached some technical extra info below: * Qcow2 image before shrinking: ---------------- $ qemu-img info rhel-7.qcow2 image: rhel-7.qcow2 file format: qcow2 virtual size: 120G (128849018880 bytes) disk size: 11G cluster_size: 65536 Snapshot list: ID TAG VM SIZE DATE VM CLOCK 1 1. Fresh installation 0 2016-04-21 23:02:43 00:00:00.000 Format specific information: compat: 1.1 lazy refcounts: true refcount bits: 16 corrupt: false ---------------- * Qcow2 image after shrinking: ---------------- $ qemu-img info rhel-7_shrinked.qcow2 image: rhel-7_shrinked.qcow2 file format: qcow2 virtual size: 120G (128849018880 bytes) disk size: 1.1G cluster_size: 65536 Format specific information: compat: 1.1 lazy refcounts: false refcount bits: 16 corrupt: false ---------------- * Command used for shrinking: ---------------- # qemu-img convert -f qcow2 -O qcow2 rhel-7.qcow2 rhel-7_shrinked.qcow2 ----------------