Chapter 6. Volume cloning for single node OpenShift
A clone is a duplicate of an existing storage volume that can be used like any standard volume. You create a clone of a volume to make a point in time copy of the data. A persistent volume claim (PVC) cannot be cloned with a different size.
6.1. Creating volume clones in single node openshift
Prerequisites
- Ensure that the source PVC is in Bound state and not in use.
- Ensure that the StorageClass is the same as that of the parent.
Procedure
- Identify the storage class of the source PVC.
Save the following YAML to a file with a name such as
odf-lvm-vol-clone.yaml
to create a volume clone.# Sample YAML to clone a volume # pvc-clone.yaml apiVersion: v1 kind: PersistentVolumeClaim Metadata: name: lvm-block-1-clone Spec: storageClassName: odf-lvm-vg1 dataSource: name: lvm-block-1 kind: PersistentVolumeClaim accessModes: - ReadWriteOnce volumeMode: Block Resources: Requests: storage: 2Gi The cloned PVC has write access.
- Create the policy by running the following command:
# oc create -f odf-lvm-vol-clone.yaml -ns lvm-policy-ns
6.2. Deleting cloned volumes in single node openshift
Procedure
- To delete the cloned volume, you can delete the cloned PVC.
oc delete pvc <clone-pvc-name> -n <namespace>