Virsh snapshot-create-as
Jump to navigation
Jump to search
↑ 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
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]
--diskspecTo indicate external snapshot and location--disk-onlyDo not save memory information--atomic--no-metadatasnapshot data is created, but any metadata is discarded (so libvirt does not treat the snapshot as current, and cannot revert to the snapshot unlessvirsh snapshot-createis 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
- Create a external snapshot
--diskspecoption, 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 VMNAMEto view snapshots
- Use
Other options[edit]
--no-metadatacreates the snapshot, but any metadata is immediately discarded (that is,libvirtdoes not treat the snapshot as current, and cannot revert to the snapshot unless --redefine is later used to teach libvirt about the metadata again).--atomicLibvirt will guarantee that the snapshot either succeeds, or fails with no changes.[6]--quiesceLibvirt 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 --validateadded in Libvirt v5.6.0 August 2019
Activities[edit]
- review
--atomicoperation option - Virsh create live backups using
virsh snapshot-create-asandvirsh blockcommit
- Related commands:
virsh snapshot-info(Allows for example to verify if snapshot is internal or external)
Related commands[edit]
virsh blockcommitvirsh domblklist- Error: unsupported configuration: external snapshot file for disk vda already exists and is not a block device
See also[edit]
- Virsh Snapshots:
virsh snapshot-create-as,virsh snapshot-info,virsh snapshot-list,virsh blockjob,virsh snapshot-revert (Destructive action),virsh snapshot-delete - libvirtd:
systemctl status libvirtd,systemctl status libvirt-guests, Libvirt release notes, logs,libvirtd.conf,/etc/libvirt/,/var/log/libvirt/ - QEMU:
qemu-img,qemu-ga,qemu.conf,virsh qemu, QEMU guest agent (qemu-ga), qcow2,qemu-nbd, qemu-img map,qemu-io,/etc/libvirt/qemu.conf, QEMU releases, VENOM,qemu-nbd --help, qemu-system, uses: docker/setup-qemu-action
Advertising: