Creating snapshots
A virtual machine snapshot preserves the current state of a running or stopped instance at a specific point in time. It can later be used to restore the instance from that point. Snapshots can be used as backups or as templates for building new virtual machines that will be copies of the original instance.
To take advantage of snapshots, the backing store must first support it. If you recall from the Managing Disk images with qemu-img recipe in Chapter 1, Getting Started with QEMU and KVM, we created a raw image type for the KVM guest. In this recipe, we are going to use the QEMU Copy-On-Write (QCOW2) image format as the backing store for the KVM instance, because the raw image format does not support snapshots.
Using the QCOW2 image format, we can create a base image containing the guest OS and everything else we need for the virtual machine, and then create several copy-on-write overlay disk images on top of the original base image. These new overlay images can be used...