14.15.2. Managing Snapshots
The sections that follow describe actions that can be done in order to manipulate domain snapshots. Snapshots take the disk, memory, and device state of a domain at a specified point-in-time, and save it for future use. Snapshots have many uses, from saving a "clean" copy of an OS image to saving a domain’s state before what may be a potentially destructive operation. Snapshots are identified with a unique name. See the libvirt website for documentation of the XML format used to represent properties of snapshots.
184.108.40.206. Creating Snapshots
virsh snapshot-createcommand creates a snapshot for domain with the properties specified in the domain XML file (such as <name> and <description> elements, as well as <disks>).
To create a snapshot, run:
snapshot-create <domain> <xmlfile>
[--redefine] [--current] [--no-metadata] [--reuse-external]
The domain name, ID, or UID may be used as the domain requirement. The XML requirement is a string must contain the <name>, <description> and <disks> elements.
Live snapshots are not supported in Red Hat Enterprise Linux. There are additional options available with the
virsh snapshot-createcommand for use with live snapshots which are visible in libvirt, but not supported in Red Hat Enterprise Linux 6.
The options available in Red Hat Enterprise Linux include:
--redefinespecifies that if all XML elements produced by
snapshot-dumpxmlare valid; it can be used to migrate snapshot hierarchy from one machine to another, to recreate hierarchy for the case of a transient domain that goes away and is later recreated with the same name and UUID, or to make slight alterations in the snapshot metadata (such as host-specific aspects of the domain XML embedded in the snapshot). When this option is supplied, the
xmlfileargument is mandatory, and the domain’s current snapshot will not be altered unless the
--currentoption is also given.
--no-metadatacreates the snapshot, but any metadata is immediately discarded (that is, libvirt does not treat the snapshot as current, and cannot revert to the snapshot unless
--redefineis later used to teach libvirt about the metadata again).
--reuse-external, if used, this option specifies the location of an existing external XML snapshot to use. If an existing external snapshot does not already exist, the command will fail to take a snapshot to avoid losing contents of the existing files.