CSI Volume Clone Support

Creating a new volume as a duplicate of an existing volume

Longhorn supports CSI volume cloning. Suppose that you have the following source-pvc:

  1. apiVersion: v1
  2. kind: PersistentVolumeClaim
  3. metadata:
  4. name: source-pvc
  5. spec:
  6. storageClassName: longhorn
  7. accessModes:
  8. - ReadWriteOnce
  9. resources:
  10. requests:
  11. storage: 10Gi

You can create a new PVC that has the exact same content as the source-pvc by applying the following yaml file:

  1. apiVersion: v1
  2. kind: PersistentVolumeClaim
  3. metadata:
  4. name: cloned-pvc
  5. spec:
  6. storageClassName: longhorn
  7. dataSource:
  8. name: source-pvc
  9. kind: PersistentVolumeClaim
  10. accessModes:
  11. - ReadWriteOnce
  12. resources:
  13. requests:
  14. storage: 10Gi

Note: In addition to the requirements listed at CSI volume cloning, the cloned-pvc must have the same resources.requests.storage as the source-pvc.

History

Available since v1.2.0


© 2019-2023 Longhorn Authors | Documentation Distributed under CC-BY-4.0

© 2023 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.