0

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.

1

Since nobody replied, what I did is simply copying the image file directly such as cp /var/lib/libvirt/images/my_vm_name.qcow2 backup.qcow2.

Whenever I want to go back to the previous version and file size, I simply delete the existing image and use the old one, something like

# cd /var/lib/libvirt/images/
# rm my_vm_name.qcow2
# cp backup.qcow2 my_vm_name.qcow2

That works so far.

1
  • yeah stackexchange is pretty dead on support...
    – andys
    Feb 18 at 5:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.