// Module included in the following assemblies:
//
// * backup_and_restore/application_backup_and_restore/oadp_built_in_data_mover/oadp-backup-restore-csi-snapshots.adoc           

:_mod-docs-content-type: PROCEDURE
[id="oadp-1-3-restoring-csi-snapshots_{context}"]
= Restoring CSI volume snapshots

[role="_abstract"]
You can restore a volume snapshot by creating a `Restore` CR.

[NOTE]
====
You cannot restore Volsync backups from OADP 1.2 with the OAPD 1.3 built-in Data Mover. It is recommended to do a file system backup of all of your workloads with Restic before upgrading to OADP 1.3. 
====

.Prerequisites

* You have access to the cluster with the `cluster-admin` role.
* You have an OADP `Backup` CR from which to restore the data.

.Procedure

. Create a YAML file for the `Restore`  CR, as in the following example:
+
.Example `Restore` CR
[source,yaml]
----
apiVersion: velero.io/v1
kind: Restore
metadata:
  name: restore
  namespace: openshift-adp
spec:
  backupName: <backup>  
# ...
----

. Apply the manifest:
+
[source,terminal]
----
$ oc create -f restore.yaml
----
+
A `DataDownload` CR is created when the restore starts. 

.Verification
* You can monitor the status of the restore process by checking the `status.phase` field of the `DataDownload` CR. Possible values are `In Progress`, `Completed`, `Failed`, or `Canceled`.

** To get a list of all `DataDownload` objects, run the following command:
+
[source,terminal]
----
$ oc get datadownloads -A
----
+
.Example output
[source,terminal]
----
NAMESPACE       NAME                   STATUS      STARTED   BYTES DONE   TOTAL BYTES   STORAGE LOCATION   AGE     NODE
openshift-adp   restore-test-1-sk7lg   Completed   7m11s     108104082    108104082     dpa-sample-1       7m11s   ip-10-0-150-57.us-west-2.compute.internal
----

** Enter the following command to check the value of the `status.phase` field of the specific `DataDownload` object:
+
[source,terminal]
----
$ oc get datadownloads <datadownload_name> -o yaml
----
+
.Example output
[source,yaml]
----
apiVersion: velero.io/v2alpha1
kind: DataDownload
metadata:
  name: restore-test-1-sk7lg
  namespace: openshift-adp
spec:
  backupStorageLocation: dpa-sample-1
  operationTimeout: 10m0s
  snapshotID: 8da1c5febf25225f4577ada2aeb9f899
  sourceNamespace: mysql-persistent
  targetVolume:
    namespace: mysql-persistent
    pv: ""
    pvc: mysql
status:
  completionTimestamp: "2023-11-02T17:01:24Z"
  node: ip-10-0-150-57.us-west-2.compute.internal
  phase: Completed
  progress:
    bytesDone: 108104082
    totalBytes: 108104082
  startTimestamp: "2023-11-02T17:00:52Z"
----
+
where:
+
`phase: Completed`:: Indicates that the CSI snapshot data is successfully restored.
