Create a volume from a source snapshot

Use the following steps to create a volume from a source snapshot.

Ensure that source snapshot is in the same namespace as the volume that is created. Volume capacity must be greater than or equal to the source snapshot's restore size. Resultant PVC must contain data from "ibm-spectrum-scale-snapshot".

# cat pvcfromsnapshot.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
   name: ibm-spectrum-scale-pvc-from-snap   
spec:
   accessModes:
   - ReadWriteMany
   resources:
      requests:
         storage: 1Gi
   storageClassName: ibm-spectrum-scale-storageclass
   dataSource:
      name: ibm-spectrum-scale-snapshot
      kind: VolumeSnapshot
      apiGroup: snapshot.storage.k8s.io
 
Issue the following command to create a PVC from snapshot.
kubectl apply -f pvcfromsnapshot.yaml
Restriction:
  • Snapshot and new volume must be from filesystems belonging to same cluster
  • Restoring snapshot to lightweight PVC of remotely mounted filesystem is not supported