| This is unreleased documentation for SUSE® Storage 1.11 (Dev). | 
Volume Clone
Clone Using YAML
Clone a CSI Snapshot
To clone a CSI snapshot, refer to the documentation on Creating a Volume from a Snapshot.
Clone a Volume with the v2 Data Engine
Assume you have a StorageClass named longhorn-v2:
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: longhorn-v2
provisioner: driver.longhorn.io
allowVolumeExpansion: true
reclaimPolicy: Delete
volumeBindingMode: Immediate
parameters:
  dataEngine: "v2"
  numberOfReplicas: "1"
  staleReplicaTimeout: "2880"And you have a PersistentVolumeClaim (PVC) named source-pvc-v2 provisioned from it:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: source-pvc-v2
spec:
  storageClassName: longhorn-v2
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10GiClone Using full-copy Mode
Create a new PVC with the same content as source-pvc-v2 by applying the following YAML. SUSE Storage will copy the data from the source PVC to the new PVC.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: cloned-pvc-v2
spec:
  storageClassName: longhorn-v2
  dataSource:
    name: source-pvc-v2
    kind: PersistentVolumeClaim
  accessModes:
    - ReadWriteOnce
  resources:
      requests:
        storage: 10GiClone Using linked-clone Mode
The full-copy mode creates a new PVC that is fully independent of the source PVC. However, it requires time and resources to copy the data.
Sometimes, you need to quickly create a temporary PVC with the same content as the source without copying the data. For example, backup solutions like Velero or Kasten can use this feature to quickly create a temporary PVC to read data and upload it to an S3 bucket.
In this scenario, use the linked-clone mode. This mode creates a new PVC that shares the same data blocks as the source PVC.
Follow these steps:
- 
Create a StorageClasswithcloneModeset tolinked-clone.kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: longhorn-v2-linked-clone provisioner: driver.longhorn.io reclaimPolicy: Delete volumeBindingMode: Immediate parameters: dataEngine: "v2" cloneMode: "linked-clone" numberOfReplicas: "1" staleReplicaTimeout: "2880"
- 
Create a new PVC that uses the StorageClassyou created and references the source PVC in thedataSourcefield.apiVersion: v1 kind: PersistentVolumeClaim metadata: name: cloned-pvc-v2-linked-clone spec: storageClassName: longhorn-v2-linked-clone dataSource: name: source-pvc-v2 kind: PersistentVolumeClaim accessModes: - ReadWriteOnce resources: requests: storage: 10Gi
| 
 | 
For more examples of linked-clone mode, see the blog post: Backup Applications with Longhorn V2 Volumes using Velero.
Clone a Volume Using the SUSE Storage UI
You can also clone a v2 data engine volume using the SUSE Storage UI:
- 
On the Volumes page, click Create Volume and select the data source ( VolumeorVolume Snapshot).
- 
From the Volumes page, select a volume and click Clone Volume in the Operation menu. 
- 
On the Volumes page, select a volume, click its name, and in the Snapshot and Backups section, identify the snapshot you want to use, then click Clone Volume. 
- 
For bulk cloning, on the Volumes page, select one or more volumes and click the Clone Volume button at the top of the table.