Source:Troubleshooting KVM QEMU
KVM/QEMU
Merging and deleting leftover snapshots
Problem
- The backup fails and the snapshot is left behind.
⇒ Solution
Use the graphical virt-manager tool to delete the snapshot or virsh, as shown in the example:
- List the available snapshots for the domain: user@hypervisor:~$ virsh snapshot-list <domain_name> Name Creation Time State ------------------------------------------------------------ Sesam_SF20173828282@XXXX 2017-07-06 08:15:11 +0200 disk-snapshot In this example, one leftover snapshot for this VM exists.
- List the virtual disks for the domain: user@hypervisor:~$ virsh domblklist <domain_name> Target Source ------------------------------------------------ sda /path/to//Sesam_SF20173828282@XXXX.snapshot
- For each device that refers to SEP sesam snapshot, start a block commit to merge the snapshot: user@hypervisor:~$ virsh blockcommit <domain_name> sda --active --verbose --pivot Block Commit: [100 %] Successfully pivoted
- Confirm that the device is now switched to the original disk device: user@hypervisor:~$ virsh domblklist <domain_name> Target Source ------------------------------------------------ sda /my/original/base.img
- Delete the snapshot metadata information: user@hypervisor:~$ virsh snapshot-delete <domain_name> --metadata --snapshotname Sesam_SF20173828282@XXXX Domain snapshot sesam_snapshot deleted
- Delete the snapshot file: user@hypervisor:~$ rm /path/to//Sesam_SF20173828282@XXXX.snapshot