V2 Volume Clone Support
Creating a new volume as a duplicate of an existing volume
To clone a CSI snapshot, refer to the documentation on Creating a Volume from a Snapshot.
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: 10Gi
full-copy
modeYou can create a new PVC with the exact same content as source-pvc-v2
by applying the YAML below. Longhorn 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: 10Gi
linked-clone
modeThe 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, you can use the linked-clone
mode. This mode creates a new PVC that shares the same data blocks as the source PVC. Follow the steps below:
cloneMode
set to linked-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"
StorageClass
and references the source PVC in the dataSource
field: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
Note:
- In addition to the requirements for CSI Volume Cloning, the cloned PVC’s (
cloned-pvc
)resources.requests.storage
must match the source PVC’s (source-pvc
) storage size.- The
linked-clone
mode is only supported by the v2 data engine.- A PVC created using
linked-clone
shares data blocks with the source and has the following limitations:
- It can have only one replica.
- It cannot be snapshotted or backed up.
- It cannot be used as the source for another clone operation.
- A source PVC can only have one
linked-clone
PVC at a time.linked-clone
PVCs are designed to be short-lived. It is highly recommended to delete them when no longer needed.
For more examples of linked-clone, see the blog post, Backup Applications with Longhorn V2 Volumes using Velero.
You can also clone a v2 data engine volume using the Longhorn UI by one of the following methods:
Volume
or Volume Snapshot
).Available since v1.10.0
© 2019-2025 Longhorn Authors | Documentation Distributed under CC-BY-4.0
© 2025 The Linux Foundation. All rights reserved. The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.