// Module included in the following assemblies:
//
// * storage/container_storage_interface/persistent-storage-csi-group-snapshots.adoc

:_mod-docs-content-type: PROCEDURE
[id="persistent-storage-csi-group-snapshots-restore_{context}"]
= Restoring a volume group snapshot

[role="_abstract"]
Restore volumes from a volume group snapshot by creating new persistent volume claims (PVCs) from individual `VolumeSnapshot` objects. Each PVC provisions a volume populated with snapshot data. Repeat for each `VolumeSnapshot` in the group to restore all volumes to their previous state.

.Prerequisites
* Logged in to a running {product-title} cluster.
* PVC has been created using a Container Storage Interface (CSI) driver that supports volume group snapshots.
* A storage class to provision the storage back end.
* A volume group snapshot has been created and is ready to use.

.Procedure
. Specify a `VolumeSnapshot` data source from a volume group snapshot for a PVC as shown in the following example:
+
.Example restore PVC YAML file
[source, yaml]
----
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: <pvc-restore-name>
  namespace: <namespace>
spec:
  storageClassName: csi-hostpath-sc
  dataSource:
    name: snapshot-fbfe59eff570171765df664280910c3bf1a4d56e233a5364cd8cb0152a35965b
    kind: VolumeSnapshot
    apiGroup: snapshot.storage.k8s.io
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
----
+
* `metadata.name`: Name of the restore PVC.
* `metadata.namespace`: Name of the namespace.
* `spec.dataSource.name`: Name of an individual volume snapshot that is part of the volume group snapshot to use as source.
* `spec.dataSource.kind`: Must be set to the `VolumeSnapshot` value.
* `spec.dataSource.apiGroup`: Must be set to the `snapshot.storage.k8s.io` value.

. Create the PVC by running the following command:
+
[source,terminal]
----
$ oc create -f <pvc-restore-filename>.yaml
----
+
Where `<pvc-restore-filename>.yaml` is the name of the PVC restore file specified in the preceding step.

. Verify that the restored PVC has been created by running the following command:
+
[source,terminal]
----
$ oc get pvc
----
+
A new PVC with the name you specified in the first step is displayed.

. Repeat the procedure as needed until all volumes are created from all the snapshots that are part of a volume group snapshot.
