KVM Snapshots with virsh: Create, List, Revert and Delete
How KVM snapshots work: internal vs external, disk-only vs full system snapshots, and the virsh commands to create, revert and merge them safely.
Published November 27, 2026
Snapshots let you freeze a VM at a known-good point, try a risky upgrade, and roll back in seconds if it goes wrong. KVM supports several snapshot styles, and choosing the wrong one is how people end up with long, slow snapshot chains. This guide explains the types and the exact virsh commands for each.
The concept
An internal snapshot is stored inside the qcow2 file itself. It can include the VM's RAM and device state (a "system checkpoint"), so reverting brings back running programs exactly where they were. Internal snapshots are easy to use but only work with qcow2, and the VM pauses briefly while memory is saved.
An external snapshot freezes the current disk file and creates a new overlay file on top of it. All new writes go to the overlay. External snapshots are the modern, recommended approach: they work live, can be quiesced with the guest agent, and are the basis of most backup tools. The catch is that reverting and deleting them involves merging chains with blockcommit or blockpull.
Snapshot types
| Type | Stored in | Includes RAM? | Best for |
|---|---|---|---|
| Internal (system checkpoint) | Same qcow2 file | Yes | Quick dev/test rollback |
| Internal disk-only | Same qcow2 file | No | Simple offline restore points |
| External disk-only | New overlay file | No | Live backups, production |
| External with memory | Overlay + memory file | Yes | Full state capture of running VMs |
External snapshot chains
Live backup with external snapshots
- Create external snapshot: VM now writes to the overlay
- Back up the now read-only base image with rsync or qemu-img
- blockcommit --active --pivot merges the overlay back into the base
- Delete the snapshot metadata and the overlay file
Internal snapshots in four commands
Practical examples
External, disk-only, quiesced snapshot
Needs qemu-guest-agent in the guest to flush filesystems.
virsh snapshot-create-as web01 nightly --disk-only --atomic --quiesce \
--diskspec vda,file=/var/lib/libvirt/images/web01-nightly.qcow2
virsh domblklist web01 # vda now points to the overlayMerge the overlay back and clean up
blockcommit copies overlay data into the base and pivots the VM back.
virsh blockcommit web01 vda --active --pivot --verbose
virsh snapshot-delete web01 nightly --metadata
rm /var/lib/libvirt/images/web01-nightly.qcow2Inspect a chain
qemu-img shows every layer in the backing chain.
qemu-img info --backing-chain -U /var/lib/libvirt/images/web01-nightly.qcow2Common mistakes
- Treating snapshots as backups. They live on the same disk; if the disk dies, so do they.
- Leaving snapshots for months. Long chains slow I/O and make merges take hours.
- Deleting an overlay file with rm while the VM still uses it.
- Reverting a database VM with a disk-only snapshot taken without --quiesce, then getting a crash-consistent but dirty database.
- Mixing internal snapshots with UEFI (pflash) firmware on older libvirt versions, which refused them.
Key takeaways
- Internal snapshots are simple and include RAM; external snapshots are live-friendly and backup-friendly.
- External snapshots create overlay chains. Merge them with blockcommit.
- Use --quiesce with the guest agent for application-consistent snapshots.
- Snapshots are short-term restore points, not a backup strategy.
FAQ
Can I revert an external snapshot with snapshot-revert?
Recent libvirt versions (9.x and later) support reverting external snapshots. On older versions you edit the VM to point back at the base image manually.
Do snapshots slow the VM down?
Slightly. Each extra layer adds lookup overhead, and the first write to each block must allocate in the overlay. Keep chains short.
How do I snapshot a raw disk?
Use external snapshots (the overlay is qcow2 on top of the raw base) or snapshot at the storage layer with LVM or ZFS.