Backing up and restoring CSI snapshots data movement
You can back up and restore persistent volumes by using the OADP 1.3 Data Mover.
Backing up persistent volumes with CSI snapshots
You can use the OADP Data Mover to back up Container Storage Interface (CSI) volume snapshots to a remote object store.
Prerequisites
- You have access to the cluster with the
cluster-adminrole. - You have installed the OADP Operator.
- You have included the CSI plugin and enabled the node agent in the
DataProtectionApplicationcustom resource (CR). - You have an application with persistent volumes running in a separate namespace.
- You have added the
metadata.labels.velero.io/csi-volumesnapshot-class: "true"key-value pair to theVolumeSnapshotClassCR.
Procedure
-
Create a YAML file for the
Backupobject, as in the following example:kind: BackupapiVersion: velero.io/v1metadata:name: backupnamespace: openshift-adpspec:csiSnapshotTimeout: 10m0sdefaultVolumesToFsBackup:includedNamespaces:- mysql-persistentitemOperationTimeout: 4h0m0ssnapshotMoveData: truestorageLocation: defaultttl: 720h0m0svolumeSnapshotLocations:- dpa-sample-1# ...where:
defaultVolumesToFsBackup- Set to
trueif you use Data Mover only for volumes that opt out offs-backup. Set tofalseif you use Data Mover by default for volumes. snapshotMoveData- Set to
trueto enable movement of CSI snapshots to remote object storage.
-
Apply the manifest:
$ oc create -f backup.yamlA
DataUploadCR is created after the snapshot creation is complete.noteIf you format the volume by using XFS filesystem and the volume is at 100% capacity, the backup fails with a
no space left on deviceerror. For example:Error: relabel failed /var/lib/kubelet/pods/3ac..34/volumes/ \kubernetes.io~csi/pvc-684..12c/mount: lsetxattr /var/lib/kubelet/ \pods/3ac..34/volumes/kubernetes.io~csi/pvc-68..2c/mount/data-xfs-103: \no space left on deviceIn this scenario, consider resizing the volume or using a different filesystem type, for example,
ext4, so that the backup completes successfully.
Verification
- Verify that the snapshot data is successfully transferred to the remote object store by monitoring the
status.phasefield of theDataUploadCR. Possible values areIn Progress,Completed,Failed, orCanceled. The object store is configured in thebackupLocationsstanza of theDataProtectionApplicationCR.-
Run the following command to get a list of all
DataUploadobjects:$ oc get datauploads -AExample outputNAMESPACE NAME STATUS STARTED BYTES DONE TOTAL BYTES STORAGE LOCATION AGE NODEopenshift-adp backup-test-1-sw76b Completed 9m47s 108104082 108104082 dpa-sample-1 9m47s ip-10-0-150-57.us-west-2.compute.internalopenshift-adp mongo-block-7dtpf Completed 14m 1073741824 1073741824 dpa-sample-1 14m ip-10-0-150-57.us-west-2.compute.internal -
Check the value of the
status.phasefield of the specificDataUploadobject by running the following command:$ oc get datauploads <dataupload_name> -o yamlExample outputapiVersion: velero.io/v2alpha1kind: DataUploadmetadata:name: backup-test-1-sw76bnamespace: openshift-adpspec:backupStorageLocation: dpa-sample-1csiSnapshot:snapshotClass: ""storageClass: gp3-csivolumeSnapshot: velero-mysql-fq8sloperationTimeout: 10m0ssnapshotType: CSIsourceNamespace: mysql-persistentsourcePVC: mysqlstatus:completionTimestamp: "2023-11-02T16:57:02Z"node: ip-10-0-150-57.us-west-2.compute.internalpath: /host_pods/15116bac-cc01-4d9b-8ee7-609c3bef6bde/volumes/kubernetes.io~csi/pvc-eead8167-556b-461a-b3ec-441749e291c4/mountphase: Completedprogress:bytesDone: 108104082totalBytes: 108104082snapshotID: 8da1c5febf25225f4577ada2aeb9f899startTimestamp: "2023-11-02T16:56:22Z"where:
phase: Completed- Indicates that snapshot data is successfully transferred to the remote object store.
-
Restoring CSI volume snapshots
You can restore a volume snapshot by creating a Restore CR.
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-adminrole. - You have an OADP
BackupCR from which to restore the data.
Procedure
-
Create a YAML file for the
RestoreCR, as in the following example:Example Restore CRapiVersion: velero.io/v1kind: Restoremetadata:name: restorenamespace: openshift-adpspec:backupName: <backup># ... -
Apply the manifest:
$ oc create -f restore.yamlA
DataDownloadCR is created when the restore starts.
Verification
- You can monitor the status of the restore process by checking the
status.phasefield of theDataDownloadCR. Possible values areIn Progress,Completed,Failed, orCanceled.-
To get a list of all
DataDownloadobjects, run the following command:$ oc get datadownloads -AExample outputNAMESPACE NAME STATUS STARTED BYTES DONE TOTAL BYTES STORAGE LOCATION AGE NODEopenshift-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.phasefield of the specificDataDownloadobject:$ oc get datadownloads <datadownload_name> -o yamlExample outputapiVersion: velero.io/v2alpha1kind: DataDownloadmetadata:name: restore-test-1-sk7lgnamespace: openshift-adpspec:backupStorageLocation: dpa-sample-1operationTimeout: 10m0ssnapshotID: 8da1c5febf25225f4577ada2aeb9f899sourceNamespace: mysql-persistenttargetVolume:namespace: mysql-persistentpv: ""pvc: mysqlstatus:completionTimestamp: "2023-11-02T17:01:24Z"node: ip-10-0-150-57.us-west-2.compute.internalphase: Completedprogress:bytesDone: 108104082totalBytes: 108104082startTimestamp: "2023-11-02T17:00:52Z"where:
phase: Completed- Indicates that the CSI snapshot data is successfully restored.
-
Deletion policy for OADP 1.3
The deletion policy determines rules for removing data from a system, specifying when and how deletion occurs based on factors such as retention periods, data sensitivity, and compliance requirements. It manages data removal effectively while meeting regulations and preserving valuable information.
Deletion policy guidelines for OADP 1.3
Review the following deletion policy guidelines for the OADP 1.3:
- In OADP 1.3.x, when using any type of backup and restore methods, you can set the
deletionPolicyfield toRetainorDeletein theVolumeSnapshotClasscustom resource (CR).