Delete a PersistentVolumeClaim
Follow the instructions on this page to delete PersistentVolumeClaims (PVCs) managed by PX-CSI. These operations help clean up unused resources.
Run the following command to remove a PVC that is no longer needed:
kubectl delete pvc <pvc-name> -n <pvc-namespace>
persistentvolumeclaim "<pvc-name>" deleted
By default, when you delete a PVC with the reclaimPolicy set to Delete:
- In PX-CSI version 25.8.0 or earlier, PX-CSI destroys and eradicates the backend volume on FlashArray and FlashBlade.
- In PX-CSI version 25.8.1 or later, PX-CSI destroys the backend volume, and eradication is handled according to the eradication settings configured on FlashArray and FlashBlade.
Known limitation
For FlashArray file services, deleting a PVC doesn't delete the persistent volume (PV) in the FlashArray if the volume contains data and remains in the Released state. You must manually delete the PVs. For more information, see Delete persistent volumes in a released state in FA file services.
Delete persistent volumes in a released state in FA file services
To delete PersistentVolume (PV) objects in the Released state, follow these steps:
-
List the PV objects in the
Releasedstate:
kubectl get pv | grep Releasedpvc-xxxxxxxx-xxxx-xxxx-xxxx-badcace9d8e2 200Gi RWO Delete Released fio-fa-files/fio-data-fio-0 fa-file-sc-v4-authsys -
Search for the
PureVolumeresource corresponding to the PersistentVolume to retrieve the volume name:kubectl get pvol -A | grep -i <persistent-volume-name>portworx xxxxxxxx-xxxx-xxxx-xxxx-d7e4a5255d7d fa-files-ga:px_xxxxxxxx-pvc-xxxxxxxx-xxxx-xxxx-xxxx-badcace9d8e2 FlashArrayFiles 41d -
Retrieve the directory name from the details of the
PureVolumeresource:kubectl get pvol <purevolume-id> -n <namespace> -o yamlapiVersion: storage.purestorage.com/v1alpha1
kind: PureVolume
metadata:
creationTimestamp: "2025-10-08T06:48:14Z"
finalizers:
- pxd.portworx.com/purevolume-protection
generation: 1
name: xxxxxxxx-xxxx-xxxx-xxxx-d7e4a5255d7d
namespace: portworx
resourceVersion: "478318113"
uid: xxxxxxxx-xxxx-xxxx-xxxx-361d5405cabc
spec:
storageBackendType: FlashArrayFiles
storageBackends:
- id: xxxxxxxx-xxxx-xxxx-xxxx-8b5e8cdeb16c
volumeID: xxxxxxxx-xxxx-xxxx-xxxx-d7e4a5255d7d
volumeName: fa-files-ga:px_xxxxxxxx-pvc-xxxxxxxx-xxxx-xxxx-xxxx-badcace9d8e2Note the
volumeNamefield. In this example, the directory name ispx_xxxxxxxx-pvc-xxxxxxxx-xxxx-xxxx-xxxx-badcace9d8e2. -
If the
pure_nfs_endpointparameter is set in theStorageClassused by the PVC, inspect theStorageClassusing the commandkubectl get storageclass <storageclass-name> -o yamlto retrieve the NFS endpoint. Otherwise, get it from thepure.jsonconfiguration file you created when installing PX-CSI. -
Log in to a worker node, create a temporary directory, and mount the NFS export:
mkdir -p /mnt/fa-files
mount <nfs-endpoint>:<directory-name> /mnt/fa-filesIn this example:
<nfs-endpoint>is the IP address retrieved from thepure.jsonfile or theStorageClass.<directory-name>is the value from thespec.volumeNamefield from the PureVolume resource.
-
Delete the directory contents, unmount the volume, and remove the temporary directory:
rm -rf /mnt/fa-files/{..?*,.[!.]*,*}
umount /mnt/fa-files
rm -rf /mnt/fa-files
After completing these steps, the PersistentVolume object is automatically deleted.