I am using qemu-kvm and virt-manager for running virtual machines. There is a snapshot UI in virt-manager to create snapshots. But after creating some snapshots and reverting back to some snapshots, I don't see the vol image file size decreases.
I am using a dynamic sized allocation qcow2 image file. I don't really know how snapshots work here. I don't see virt-manager creates any new images. It's just creating xml files for each snapshot. That's all. For each snapshot, there will be a new xml file in /var/lib/libvirt/qemu/snapshot/my_vm_name/*.xml. There is only one image file for this vm I can find is at /var/lib/libvirt/images/my_vm_name.qcow2.
I am compiling firmwares on this virtual machine. Due to the limited size of my harddrive, I would like to clean everything and free spaces after the compilatioin is completed. But reverting back to a snapshot and deleting snapshots doesn't reduce the size of my_vm_name.qcow2 image file. I just want the image file size to become the old fresh one before the compilation. How can I acheive that? Is that safe just to backup the file itself directly and replace it with the old file when I complete compilation tasks?
Thanks a lot for your help.