:_mod-docs-content-type: ASSEMBLY
[id="virt-backup-restore-snapshots"]
= Backup and restore by using VM snapshots
include::_attributes/common-attributes.adoc[]
:context: virt-backup-restore-snapshots

toc::[]

[role="_abstract"]
You can back up and restore virtual machines (VMs) by using snapshots.

Snapshots are supported by the following storage providers:

// Hiding in ROSA/OSD as not supported
ifndef::openshift-rosa,openshift-dedicated,openshift-rosa-hcp[]
* {rh-storage-first}
* Any other cloud storage provider with the Container Storage Interface (CSI) driver that supports the Kubernetes Volume Snapshot API
endif::openshift-rosa,openshift-dedicated,openshift-rosa-hcp[]
ifdef::openshift-rosa,openshift-dedicated,openshift-rosa-hcp[]
* Any cloud storage provider with the Container Storage Interface (CSI) driver that supports the Kubernetes Volume Snapshot API
endif::openshift-rosa,openshift-dedicated,openshift-rosa-hcp[]

To create snapshots of a VM in the `Running` state with the highest integrity, install the QEMU guest agent if it is not included with your operating system. The QEMU guest agent is included with the default Red{nbsp}Hat templates.

[IMPORTANT]
====
Online snapshots are supported for virtual machines that have hot plugged virtual disks. However, hot plugged disks that are not in the virtual machine specification are not included in the snapshot.

Ensure that the QEMU guest agent is installed and running on the virtual machine before you take an online snapshot.

The QEMU guest agent stops responding to file system operations to ensure that the snapshot captures a consistent state.
====

The QEMU guest agent takes a consistent snapshot by attempting to quiesce the VM file system. This ensures that in-flight I/O is written to the disk before the snapshot is taken. If the guest agent is not present, quiescing is not possible and a best-effort snapshot is taken.

The conditions under which a snapshot is taken are reflected in the snapshot indications that are displayed in the web console or CLI. If these conditions do not meet your requirements, try creating the snapshot again or use an offline snapshot

include::modules/virt-about-vm-snapshots.adoc[leveloffset=+1]

include::modules/virt-about-application-consistent-backups.adoc[leveloffset=+1]

include::modules/virt-creating-vm-snapshot-web.adoc[leveloffset=+1]

include::modules/virt-creating-vm-snapshot-cli.adoc[leveloffset=+1]

include::modules/virt-verifying-online-snapshot-creation-with-snapshot-indications.adoc[leveloffset=+1]

include::modules/virt-restoring-vm-from-snapshot-web.adoc[leveloffset=+1]

include::modules/virt-restoring-vm-from-snapshot-cli.adoc[leveloffset=+1]

include::modules/virt-deleting-vm-snapshot-web.adoc[leveloffset=+1]

include::modules/virt-deleting-vm-snapshot-cli.adoc[leveloffset=+1]

// Hiding in ROSA/OSD as not supported
ifndef::openshift-rosa,openshift-dedicated,openshift-rosa-hcp[]
[role="_additional-resources-snapshots"]
== Additional resources
* xref:../../storage/container_storage_interface/persistent-storage-csi-snapshots.adoc#persistent-storage-csi-snapshots[CSI Volume Snapshots]
endif::openshift-rosa,openshift-dedicated,openshift-rosa-hcp[]
