Skip to main content
Version: 25.4.0

Manage snapshots for FlashBlade Direct Access volumes

PX-CSI supports snapshot and restore functionality for FlashBlade Direct Access volumes. This page describes how to create on-demand snapshots, restore volumes from those snapshots, and delete snapshots when they are no longer needed. Snapshots are useful for point-in-time rollback.

note

FlashBlade supports restoring only from the most recent snapshot. To restore from an earlier snapshot, you must first delete all snapshots created after the one you want to restore.

Prerequisites

Before you begin, ensure the following requirements are met:

  • FlashBlade API version 2.15 or later (Purity 4.5 or later)

  • A PersistentVolumeClaim (PVC) backed by a FlashBlade storage class with reclaimPolicy set to Retain. For more information about reclaimPolicy, refer to Reclaim policy .

    For example:

    Kind: Storageclass
    apiVersion: storage.k8s.io/v1
    metadata:
    name: px-fb-direct-access-nfsv4-retain
    provisioner: pxd.portworx.com
    parameters:
    backend: "pure_file"
    pure_export_rules: "*(rw)"
    mountOptions:
    - nfsvers=4.1
    volumeBindingMode: WaitForFirstConsumer
    allowVolumeExpansion: true
    reclaimPolicy: Retain

Create a snapshot

Follow these steps to create a snapshot:

  1. Create a VolumeSnapshotClass to define how snapshots are handled in your cluster. For FlashBlade Direct Access, set the driver to pxd.portworx.com and specify a deletion policy such as Delete or Retain, depending on your snapshot lifecycle requirements. For more information about deletionPolicy, refer to DeletionPolicy.

    apiVersion: snapshot.storage.k8s.io/v1
    kind: VolumeSnapshotClass
    metadata:
    name: px-csi-fbda-class
    driver: pxd.portworx.com
    deletionPolicy: Delete
  2. Create a VolumeSnapshot to capture the state of your PersistentVolumeClaim using the class defined above:

    apiVersion: snapshot.storage.k8s.io/v1
    kind: VolumeSnapshot
    metadata:
    name: <px-csi-fbda-snapshot>
    namespace: <your-pvc-namespace> # must match the PVC's namespace
    spec:
    volumeSnapshotClassName: px-csi-fbda-class
    source:
    persistentVolumeClaimName: <your-pvc-name>
  3. Verify snapshot creation:

    kubectl get volumesnapshot <px-csi-fbda-snapshot>
    kubectl describe volumesnapshot <px-csi-fbda-snapshot>

Restore from a snapshot

FlashBlade supports only in-place volume restoration. This means the existing persistent volume (PV) is overwritten with data from the snapshot. The restore process doesn’t create a new volume.

To restore from the latest snapshot, follow these steps:

  1. Retrieve the PersistentVolume bound to your PVC:

    kubectl get pvc <your-pvc-name> -o jsonpath='{.spec.volumeName}'
  2. Update the reclaim policy to Retain if it is currently set to Delete.
    Skip this step if the PersistentVolume (PV) was provisioned with a StorageClass that has reclaimPolicy: Retain

    important

    This ensures that the PersistentVolume and the FileSystem on FlashBlade remains available after the PVC is deleted.

    kubectl patch pv <pv-name> -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}'
  3. Scale down the Deployment that uses the persistent volume you want to restore.

  4. Delete the PersistentVolumeClaim. You must delete the original PersistentVolumeClaim before restoring from a snapshot, as FlashBlade supports only in-place volume restoration.

    kubectl delete pvc <your-pvc-name>
  5. Create a new PersistentVolumeClaim from the snapshot:

    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
    name: <your-pvc-name> # Use the original PVC name
    spec:
    storageClassName: px-fb-direct-access-nfsv4-retain
    dataSource:
    name: <px-csi-fbda-snapshot>
    kind: VolumeSnapshot
    apiGroup: snapshot.storage.k8s.io
    accessModes:
    - ReadWriteOnce
    resources:
    requests:
    storage: 5Gi # Ensure that the size is the same as the original PVC, otherwise the snapshot restore will fail.
  6. Apply the above spec and verify that the new PersistentVolumeClaim object is created and bound:

    kubectl get pvc <your-pvc-name>
    kubectl describe pvc <your-pvc-name>
    note

    To inspect a newly restored volume using pxctl volume inspect, you must first retrieve the volume ID.

    1. Run the kubectl get pv <persistent-volume> -o yaml command to get the PersistentVolume details.
    2. From the output, locate the volumeHandle field. Use the value of volumeHandle as the volume ID in the following command: pxctl volume inspect <volume-id>
  7. Scale up the Deployment.

Delete a snapshot

Follow these steps to delete a snapshot and free up storage:

  1. Delete the VolumeSnapshot object. This deletes the VolumeSnapshot object and also removes the corresponding snapshot from FlashBlade storage.

    kubectl delete volumesnapshot <px-csi-fbda-snapshot>
  2. Verify that the snapshot has been removed:

    kubectl get volumesnapshot <px-csi-fbda-snapshot>

Limitations

  • FlashBlade supports restoring only the latest snapshot.
  • You can create up to 64 snapshots per volume.
  • No support for automatic snapshot retention or expiry; manual cleanup is required.
  • You must delete the original PersistentVolumeClaim (with ReclaimPolicy set to Retain) before restoring from a snapshot.
  • If the deletionPolicy is set to Retain in the VolumeSnapshotClass, you must manually delete the snapshot from the FlashBlade, even though the snapshot is deleted from Kubernetes.