Difference between revisions of "Virsh snapshot-create-as"

From wikieduonline
Jump to navigation Jump to search
 
(15 intermediate revisions by the same user not shown)
Line 6: Line 6:
 
:<code>--disk-only</code> Do not save memory information
 
:<code>--disk-only</code> Do not save memory information
 
:<code>--atomic</code>
 
:<code>--atomic</code>
:<code>--no-metadata</code> 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 <code>[[virsh snapshot-create]]</code> 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: <code>[[virsh snapshot-delete]] vm1 --metadata [name|--current]</code>)<ref>https://wiki.libvirt.org/page/Live-disk-backup-with-active-blockcommit</ref> (See also: <code>[[virsh snapshot-list]]</code>)
+
:<code>--no-metadata</code> 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 <code>[[virsh snapshot-create]]</code> 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: <code>[[virsh snapshot-delete]] vm1 --metadata [name|--current]</code>)<ref>https://wiki.libvirt.org/page/Live-disk-backup-with-active-blockcommit</ref> (See also: <code>[[virsh snapshot-list]]</code>)
 +
:<code>--reuse-external</code> ([[Libvirtd changelog|2012]])<ref>https://www.redhat.com/archives/libvir-list/2012-January/msg00291.html</ref>
 +
 
  
 
== Examples ==
 
== Examples ==
Line 17: Line 19:
 
<pre> 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 </pre> <ref>https://www.cyberciti.biz/faq/how-to-create-create-snapshot-in-linux-kvm-vmdomain/</ref>
 
<pre> 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 </pre> <ref>https://www.cyberciti.biz/faq/how-to-create-create-snapshot-in-linux-kvm-vmdomain/</ref>
  
* Create a '''external''' snapshot <code>--diskspec</code> option, also using <code>--no-metadata</code>
+
* Create a '''external''' snapshot <code>[[--diskspec]]</code> option, also using <code>--no-metadata</code>
 
<pre>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</pre>
 
<pre>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</pre>
  
Line 25: Line 27:
  
 
== Other options ==
 
== Other options ==
: <code>--no-metadata</code> 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).
+
: <code>--no-metadata</code> creates the snapshot, but any metadata is immediately discarded (that is, <code>[[libvirt]]</code> 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).
 
: <code>--atomic</code> Libvirt will guarantee that the snapshot either succeeds, or fails with no changes.<ref>https://blog.devzero.be/post/kvm-live-vm-backup/</ref>
 
: <code>--atomic</code> Libvirt will guarantee that the snapshot either succeeds, or fails with no changes.<ref>https://blog.devzero.be/post/kvm-live-vm-backup/</ref>
 
: <code>--quiesce</code> 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. <ref>https://blog.devzero.be/post/kvm-live-vm-backup/</ref>
 
: <code>--quiesce</code> 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. <ref>https://blog.devzero.be/post/kvm-live-vm-backup/</ref>
:: <code>error: argument unsupported: [[QEMU]] guest agent is not configured</code><ref>https://www.redhat.com/archives/libvirt-users/2015-December/msg00009.html</ref> (See: <code>[[virsh edit]]</code>)
+
:: <code>error: argument unsupported: [[QEMU guest agent]] is not configured</code><ref>https://www.redhat.com/archives/libvirt-users/2015-December/msg00009.html</ref> (See: <code>[[virsh edit]]</code>)
 +
:<code>virsh snapshot-create --validate</code> added in [[Libvirt changelog|Libvirt v5.6.0]] August 2019
  
 
== Activities ==
 
== Activities ==
Line 34: Line 37:
 
# [[Virsh create live backups]] using <code>[[virsh snapshot-create-as]]</code> and <code>[[virsh blockcommit]]</code>
 
# [[Virsh create live backups]] using <code>[[virsh snapshot-create-as]]</code> and <code>[[virsh blockcommit]]</code>
  
* Related commands: [[virsh snapshot-info]] (Allows for example to verify if snapshot is internal or external)
+
* Related commands: <code>[[virsh snapshot-info]]</code> (Allows for example to verify if snapshot is internal or external)
  
 +
== Related commands ==
 +
* <code>[[virsh blockcommit]]</code>
 +
* <code>[[virsh domblklist]]</code>
 +
* [[Error: unsupported configuration: external snapshot file for disk vda already exists and is not a block device]]
  
 
== See also ==
 
== See also ==
 
* {{virsh snapshot}}
 
* {{virsh snapshot}}
* <code>[[virsh define]]</code>
+
* {{libvirtd}}
 
* {{QEMU}}
 
* {{QEMU}}
  
 
[[Category:KVM]]
 
[[Category:KVM]]
 
[[Category:Linux]]
 
[[Category:Linux]]

Latest revision as of 03:28, 30 September 2020

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)
--reuse-external (2012)[4]


Examples[edit]

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 

[5]

  • 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[edit]

--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.[6]
--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. [7]
error: argument unsupported: QEMU guest agent is not configured[8] (See: virsh edit)
virsh snapshot-create --validate added in Libvirt v5.6.0 August 2019

Activities[edit]

  1. review --atomic operation option
  2. Virsh create live backups using virsh snapshot-create-as and virsh blockcommit
  • Related commands: virsh snapshot-info (Allows for example to verify if snapshot is internal or external)

Related commands[edit]

See also[edit]

  • http://manpages.ubuntu.com/manpages/eoan/man1/virsh.1.html#snapshot%20commands
  • http://manpages.ubuntu.com/manpages/eoan/man1/virsh.1.html#snapshot%20commands
  • https://wiki.libvirt.org/page/Live-disk-backup-with-active-blockcommit
  • https://www.redhat.com/archives/libvir-list/2012-January/msg00291.html
  • https://www.cyberciti.biz/faq/how-to-create-create-snapshot-in-linux-kvm-vmdomain/
  • https://blog.devzero.be/post/kvm-live-vm-backup/
  • https://blog.devzero.be/post/kvm-live-vm-backup/
  • https://www.redhat.com/archives/libvirt-users/2015-December/msg00009.html
  • Advertising: