I use qcow2 file format and create snapshots using a Virt-manager GUI.
I assume I have 100GB disk space and 70% is used by VM at this moment. The qcow2-file size is about 70GB. I create a snapshot. It is stored inside the qcow2-file, we know. After some days the qcow2-file size is rised up to 120GB. OK, we understand, why. I delete this snapshot, but the qcow2-file size does not change!
"qemu-img info" does not show me any snapshots for this qcow2-file! How to see, what's inside this file and how to clean it up?
I've used "qemu-img convert" but I have a feeling inside that it's not the rigth way to decrease the file size.
Best Answer
In order to shrink the image, I'd suggest to use virt-sparsify
Make sure you have enough space in the TMPDIR, otherwise the conversion would crash.
Don't use virt-sparsify on running VM images. You may end up with corrupted image! (see man)
Then you can also use compress option (-c) of the qemu-img convert. However that would probably have some impact on the performance, but probably only during startup and initial load of services.