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.
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 toRetain
. For more information aboutreclaimPolicy
, 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:
-
Create a
VolumeSnapshotClass
to define how snapshots are handled in your cluster. For FlashBlade Direct Access, set the driver topxd.portworx.com
and specify a deletion policy such asDelete
orRetain
, depending on your snapshot lifecycle requirements. For more information aboutdeletionPolicy
, refer to DeletionPolicy.apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotClass
metadata:
name: px-csi-fbda-class
driver: pxd.portworx.com
deletionPolicy: Delete -
Create a
VolumeSnapshot
to capture the state of yourPersistentVolumeClaim
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> -
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:
-
Retrieve the PersistentVolume bound to your PVC:
kubectl get pvc <your-pvc-name> -o jsonpath='{.spec.volumeName}'
-
Update the reclaim policy to
Retain
if it is currently set toDelete
.
Skip this step if the PersistentVolume (PV) was provisioned with a StorageClass that hasreclaimPolicy: Retain
importantThis 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"}}'
-
Scale down the Deployment that uses the persistent volume you want to restore.
-
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>
-
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. -
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>noteTo inspect a newly restored volume using
pxctl volume inspect
, you must first retrieve the volume ID.- Run the
kubectl get pv <persistent-volume> -o yaml
command to get the PersistentVolume details. - From the output, locate the
volumeHandle
field. Use the value ofvolumeHandle
as the volume ID in the following command:pxctl volume inspect <volume-id>
- Run the
-
Scale up the Deployment.
Delete a snapshot
Follow these steps to delete a snapshot and free up storage:
-
Delete the
VolumeSnapshot
object. This deletes theVolumeSnapshot
object and also removes the corresponding snapshot from FlashBlade storage.kubectl delete volumesnapshot <px-csi-fbda-snapshot>
-
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 toRetain
) before restoring from a snapshot. - If the
deletionPolicy
is set toRetain
in the VolumeSnapshotClass, you must manually delete the snapshot from the FlashBlade, even though the snapshot is deleted from Kubernetes.