Clone Volumes
Longhorn supports CSI volume cloning.
Clone a Volume Using YAML
Suppose that you have the following source-pvc:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: source-pvc
spec:
  storageClassName: longhorn
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10GiYou can create a new PVC that has the exact same content as the source-pvc by applying the following yaml file:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: cloned-pvc
spec:
  storageClassName: longhorn
  dataSource:
    name: source-pvc
    kind: PersistentVolumeClaim
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10GiNote: In addition to the requirements listed at CSI volume cloning, the
cloned-pvcmust have the sameresources.requests.storageas thesource-pvc.
Clone Volume Using the Longhorn UI
Clone a volume
- 
Go to the Volume page. 
- 
Select a volume, and then click Clone Volume in the Operation menu. 
- 
(Optional) Configure the settings of the new volume. 
- 
Click OK. 
Clone a Volume Using a Snapshot
- 
Go to the Volume page. 
- 
Click the name of the volume that you want to clone. 
- 
In the Snapshot and Backups section of the details screen, identify the snapshot that you want to use and then click Clone Volume. 
- 
(Optional) Configure the settings of the new volume. 
- 
Click OK. 
 
Clone Multiple Volumes (Bulk Cloning)
- 
Go to the Volume page. 
- 
Select the volume you want to clone. 
- 
Click Clone Volume button on top of the table. 
- 
(Optional) Configure the settings of the new volumes 
- 
Click OK 
Note:
The Longhorn UI pre-fills certain fields and prevents you from modifying the values to ensure that those match the settings of the source volume.
Longhorn automatically attaches the new volume, clones the source volume, and then detaches the new volume.
