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.


2 Answers 2


qcow2 images can be inspected & mounted using quemu-nbd.

qemu-nbd --connect=/dev/nbd0 /path/to/your/vm-image.qcow2
fdisk /dev/nbd0 -l
mount /dev/nbd0p1 /mnt/your/mountpoint/

to list/create/delete snapshots use qemu-img snapshot

e.g. to list the available snapshots

qemu-img snapshot -l /path/to/your/vm-image.qcow2

to check snapshots content mount the snapshot

qemu-nbd --connect=/dev/nbd0 /path/to/your/vm-image.qcow2 --load-snapshot=1

the snapshot identifier is either its id or the name

  • How does this show snapshots? Jan 2, 2021 at 20:21
  • @MichaelHampton Expanded the answer to cover snapshot handling/mounting.
    – hargut
    Jan 6, 2021 at 9:37

In order to shrink the image, I'd suggest to use virt-sparsify

export TMPDIR=/var/tmp/
virt-sparsify --check-tmpdir=continue <name>.qcow2 <name>_sparsed.qcow2

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.

  • Should I run virt-sparsify only when the VM's state is off? Nov 10, 2017 at 9:40
  • @IgorSchaefer Yes, it's required. Otherwise the disk image could be corrupted! Nov 10, 2017 at 9:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .