<commit_before>// Module included in the following assemblies:
//
// * storage/persistent_storage/persistent-storage-csi-cloning.adoc

[id="persistent-storage-csi-cloning-provisioning_{context}"]
= Provisioning a CSI volume clone

Provisioning of a CSI volume clone is triggered by the creation of a cloned persistent volume claim (PVC) API object. The cloned PVC is pre-populated with the contents of another PVC. After creation, the cloned volume adheres to the same rules as any other persistent volume.

.Prerequisites
* Logged in to a running {product-title} cluster.
* A PVC created using a CSI driver that supports volume cloning.
* Storage back end is configured for dynamic provisioning. Cloning support is not available for static provisioners.
* Source and destination PVCs must exist in the same namespace.
* Source and destination storage class must be the same.

.Procedure

Clones are provisioned like any other PVC, with the exception of adding a `dataSource` that references an existing PVC in the same namespace.

To clone a PVC from an existing PVC:

. Define the PersistentVolumeClaim object as shown in the following example:

+
.pvc-clone.yaml
[source,yaml]
----
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-1-clone
  namespace: mynamespace
spec:
  storageClassName: csi-cloning <1>
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
----
+
<1> Name of the storage class that provisions the storage back end. Default storage class can be used and `storageClassName` can be omitted in the spec.
+
. Create the object you saved in the previous step by running the following command:
+
----<commit_msg>Add dataSource to CSI cloning example<commit_after>// Module included in the following assemblies:
//
// * storage/persistent_storage/persistent-storage-csi-cloning.adoc

[id="persistent-storage-csi-cloning-provisioning_{context}"]
= Provisioning a CSI volume clone

Provisioning of a CSI volume clone is triggered by the creation of a cloned persistent volume claim (PVC) API object. The cloned PVC is pre-populated with the contents of another PVC. After creation, the cloned volume adheres to the same rules as any other persistent volume.

.Prerequisites
* Logged in to a running {product-title} cluster.
* A PVC created using a CSI driver that supports volume cloning.
* Storage back end is configured for dynamic provisioning. Cloning support is not available for static provisioners.
* Source and destination PVCs must exist in the same namespace.
* Source and destination storage class must be the same.

.Procedure

Clones are provisioned like any other PVC, with the exception of adding a `dataSource` that references an existing PVC in the same namespace.

To clone a PVC from an existing PVC:

. Define the PersistentVolumeClaim object as shown in the following example:

+
.pvc-clone.yaml
[source,yaml]
----
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-1-clone
  namespace: mynamespace
spec:
  storageClassName: csi-cloning <1>
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
  dataSource:
    kind: PersistentVolumeClaim
    name: pvc-1
----
+
<1> Name of the storage class that provisions the storage back end. Default storage class can be used and `storageClassName` can be omitted in the spec.
+
. Create the object you saved in the previous step by running the following command:
+
----
{'fraction_non_alphanumeric': 0.06301050175029171, 'fraction_numerical': 0.0032088681446907816, 'mean_word_length': 4.1797583081570995, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3629299', 'n_tokens_mistral': 948, 'n_tokens_neox': 920, 'n_words': 444}