Virsh snapshot-create-as

From wikieduonline
Revision as of 10:06, 6 January 2020 by Welcome (talk | contribs)
Jump to navigation Jump to search
virsh snapshot-create-as domain[1] {[--print-xml] | [--no-metadata] [--halt] [--reuse-external]} [name] [description] [--disk-only [--quiesce]] [--atomic] [[--live] [--memspec memspec]] [--diskspec] diskspec]...


virsh snapshot-create-as [2]

--diskspec To indicate external snapshot and location
--disk-only Do not save memory information
--atomic
--no-metadata snapshot data is created, but any metadata is discarded (so libvirt does not treat the snapshot as current, and cannot revert to the snapshot unless virsh snapshot-create is used to teach libvirt about discarded metadata information). Useful if you plan to merge snapshots otherwise at a later point you have to explicitly clean the libvirt metadata (by invoking: virsh snapshot-delete vm1 --metadata [name|--current])[3] (See also: virsh snapshot-list)

Examples

virsh snapshot-create-as --domain MY_VM --name "Snapshot_2019_08" --description "Snapshot before critical operation" --live
  • Take a Disk state (--disk-only) (not memory) from a running VM (--live)
 virsh snapshot-create-as --domain MY_VM --name "Snapshot_disk_only_2019_08_MY_VM" --description "Disk snapshot only to disk" --disk-only --live --atomic 

[4]

  • Create a external snapshot --diskspec option, also using --no-metadata
virsh snapshot-create-as --domain MY_VM --name "napshot_disk_only_2019_08_MY_VM" --description "Disk snapshot only to disk" --disk-only --no-metadata --atomic --diskspec $TARGET,snapshot=external
Errors:
error: unsupported configuration: external snapshot file for disk hdXX already exists and is not a block device
Use virsh snapshot-list VMNAME to view snapshots

Other options

--no-metadata creates 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 --redefine is later used to teach libvirt about the metadata again).
--atomic Libvirt will guarantee that the snapshot either succeeds, or fails with no changes.[5]
--quiesce Libvirt will try to use guest agent to freeze and unfreeze domain’s mounted file systems. However, if domain has no guest agent, snapshot creation will fail. [6]
error: argument unsupported: QEMU guest agent is not configured[7] (See: virsh edit)

Activities

  1. review --atomic operation option
  2. Virsh create live backups using virsh snapshot-create-as and virsh blockcommit

See also

Advertising: