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

  1. Identify the storage class of the source PVC.
  2. 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.
  3. 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>
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.