KVM virsh external vs internal snapshots

Internal snapshots

Internal snapshots are the snapshots that QEMU has supported for a long time. Libvirt refers to them as internal because all the data is stored as part of the qcow2 disk image. Internal snapshot is the default snapshot mode if using the virsh snapshot-* commands.

Pros:

  • When you have a VM with a single qcow2 disk image and take 10 snapshots, you still have only one file to manage.
  • Internal snapshots can combine disk and VM memory state for 'checkpointing', so you can jump back and forth between a saved running VM state.
  • A snapshot of an offline VM can also be performed, and only the disk contents will be saved.

Cons:

  • Works only with qcow2 disk images. Since virt-manager has historically used raw images, pre-existing VMs may not be able to work with this type.
  • They are non-live, meaning the VM has to be paused while all the state is saved. For end users this likely isn't a problem, but if you are running a public server, minimizing downtime is essential.
  • Historically they were rather slow, but this has improved quite a bit with QEMU 1.6+

External snapshots

External snapshots are for safely creating copy-on-write overlay files for a running VM's disk images. QEMU has supported copy-on-write overlay files for a long time, but the ability to create them for a running VM is only a couple years old. They are called external because every snapshot creates a new overlay file.

Pros:

  • While the overlay files have to be qcow2, these snapshots will work with any base disk image.
  • Can also be performed with very little VM downtime, at least under a second.
  • The external nature also allows different use cases like live backup: create a snapshot, back up the original backing image, when backup completes, merge the overlay file changes back into the backing image.

Cons:

  • Compared to internal snapshots, which are an end to end solution with all the complexity handled in QEMU, external snapshots are just a building block for handling the use cases I described above... and the many of the pieces haven't been filled in yet. Libvirt still needs a lot of work to reach feature parity with what internal snapshots already provide. This is understandable, as the main driver for external snapshot support was for features like live backup that internal snapshots weren't suited for. Once that point was reached, there hasn't been much of a good reason to do the difficult work of filling in the remaining support when internal snapshots already fit the bill.
Edit
Pub: 27 Feb 2018 09:54 UTC
Edit: 01 Mar 2018 07:41 UTC
Views: 4167