Skip to main content
Version: 25.8

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
Volume deletion behavior

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:

  1. List the PV objects in the Released state:


    kubectl get pv | grep Released

    pvc-xxxxxxxx-xxxx-xxxx-xxxx-badcace9d8e2   200Gi      RWO            Delete           Released   fio-fa-files/fio-data-fio-0   fa-file-sc-v4-authsys
  2. Search for the PureVolume resource 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
  3. Retrieve the directory name from the details of the PureVolume resource:

    kubectl get pvol <purevolume-id> -n <namespace> -o yaml
    apiVersion: 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-badcace9d8e2

    Note the volumeName field. In this example, the directory name is px_xxxxxxxx-pvc-xxxxxxxx-xxxx-xxxx-xxxx-badcace9d8e2.

  4. If the pure_nfs_endpoint parameter is set in the StorageClass used by the PVC, inspect the StorageClass using the command kubectl get storageclass <storageclass-name> -o yaml to retrieve the NFS endpoint. Otherwise, get it from the pure.json configuration file you created when installing PX-CSI.

  5. 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-files

    In this example:

    • <nfs-endpoint> is the IP address retrieved from the pure.json file or the StorageClass.
    • <directory-name> is the value from the spec.volumeName field from the PureVolume resource.
  6. 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.