Deleting snapshots
In this quick recipe, we are going to delete the snapshots we created earlier in the Creating snapshots recipe, using libvirt.
Getting ready
For this recipe, we are only going to need the following:
- A libvirt host with the QEMU toolset
- The snapshots we created in the Creating snapshots recipe
How to do it...
To delete a snapshot, follow these steps:
- List all snapshots present on the host:
root@kvm:~# virsh snapshot-list kvm1 Name Creation Time State ------------------------------------------------------------ 1492797458 2017-04-21 17:57:38 +0000 running 1492802417 2017-04-21 19:20:17 +0000 running kvm1_ext_snapshot_renamed 2017-04-21 18:08:49 +0000 disk-snapshot root@kvm:~#
- Delete the latest snapshot based on the creation time:
root@kvm:~# virsh snapshot-delete kvm1 --snapshotname 1492802417 Domain snapshot 1492802417 deleted root@kvm:~#
- List the remaining snapshots:
root@kvm:~# virsh snapshot-list kvm1 Name ...