1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/lvms-restoring-volume-snapshots.adoc
2024-06-24 15:07:44 +00:00

71 lines
2.2 KiB
Plaintext

// Module included in the following assemblies:
//
// storage/persistent_storage/persistent_storage_local/persistent-storage-using-lvms.adoc
:_mod-docs-content-type: PROCEDURE
[id="lvms-restoring-volume-snapshots_{context}"]
= Restoring volume snapshots
To restore a volume snapshot, you must create a persistent volume claim (PVC) with the `dataSource.name` field set to the name of the volume snapshot.
The restored PVC is independent of the volume snapshot and the source PVC.
.Prerequisites
* You have access to {product-title} as a user with `cluster-admin` permissions.
* You have created a volume snapshot.
.Procedure
. Log in to the OpenShift CLI (`oc`).
. Create a `PersistentVolumeClaim` object with the configuration to restore the volume snapshot:
+
.Example `PersistentVolumeClaim` object to restore a volume snapshot
[source,yaml]
----
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: lvm-block-1-restore
spec:
accessModes:
- ReadWriteOnce
volumeMode: Block
Resources:
Requests:
storage: 2Gi <1>
storageClassName: lvms-vg1 <2>
dataSource:
name: lvm-block-1-snap <3>
kind: VolumeSnapshot
apiGroup: snapshot.storage.k8s.io
----
<1> Specify the storage size of the restored PVC. The storage size of the requested PVC must be greater than or equal to the stoage size of the volume snapshot that you want to restore. If a larger PVC is required, you can also resize the PVC after restoring the volume snapshot.
<2> Set this field to the value of the `storageClassName` field in the source PVC of the volume snapshot that you want to restore.
<3> Set this field to the name of the volume snapshot that you want to restore.
. Create the PVC in the namespace where you created the volume snapshot by running the following command:
+
[source,terminal]
----
$ oc create -f <file_name> -n <namespace>
----
.Verification
* To verify that the volume snapshot is restored, run the following command:
+
[source, terminal]
----
$ oc get pvc -n <namespace>
----
+
.Example output
+
[source, terminal]
----
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
lvm-block-1-restore Bound pvc-e90169a8-fd71-4eea-93b8-817155f60e47 1Gi RWO lvms-vg1 5s
----