OpenShift - Resolve Persistent Volume Claim Lost

by
Jeremy Canfield |
Updated: October 05 2024
| OpenShift articles
Let's say you have a Persistent Volume Claim that is LOST.
~]$ oc get pvc --namespace my_project
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
my-persistent-volume-claim Lost my-persistent-volume-claim 0 file-storage 12m
The most common reasons for this are:
- volumeName in the Persistent Volume Claim does NOT match the name of the Persistent Volume
- The Persistent Volume Claim is requesting more storage than is available in the Persistent Volume
- The Persistent Volume Claim is requesting Access Modes that are not in the Persistent Volume
- The Persistent Volume Claim is using a different storage class than the Persistent Volume
- The Persistent Volume was created with a claimRef that is exactly the same as the Persistent Volume Claim name
The oc get pvc command can be used to display details about the Persistent Volume Claim.
- In this example, the volumeName in the Persistent Volume Claim is my-persistent-volume
- In this example, the Persistent Volume Claim is requesting 2Gi.
- In this example, the Persistent Volume Claim is requesting Access Modes ReadOnlyOnce and ReadWriteOnce.
- In this example, the Persistent Volume Claim has storage class file-storage.
~]$ oc get pvc my-persistent-volume-claim --namespace my_project --output yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-persistent-volume-claim
namespace: my_project
spec:
accessModes:
- ReadOnlyOnce
- ReadWriteOnce
resources:
requests:
storage: 2Gi
storageClassName: file-storage
volumeMode: Block
volumeName: my-persistent-volume
The oc get pv command can be used to display details about the Persistent Volume.
- In this example, if the name of the Persistent Volume is NOT my-persistent-volume, then the Persistent Volume may remain LOST.
- In this example, if the Persistent Volume has less than 2Gi available, then the Persistent Volume may remain LOST.
- In this example, if the Persistent Volume does NOT have Access Modes ReadOnlyOnce and ReadWriteOnce, then the Persistent Volume may remain LOST.
- In this example, if the Persistent Volume does NOT have storage class file-storage, then the Persistent Volume may remain LOST.
- In this example, if the Persistent Volume was created with claimRef my-persistent-volume and you create the Persistent Volume with the same name as the claimRef, then the Persistent Volume may remain LOST.
~]$ oc get pv my-persistent-volume --output yaml
kind: PersistentVolume
apiVersion: v1
metadata:
name: my-persistent-volume
labels:
name: my-persistent-volume
spec:
capacity:
storage: 1Gi
csi:
driver: efs.csi.aws.com
accessModes:
- ReadOnlyMany
- ReadWriteMany
- ReadWriteOnce
claimRef:
kind: PersistentVolumeClaim
namespace: my-project
name: my-persistent-volume-claim
persistentVolumeReclaimPolicy: Delete
storageClassName: efs-sc
volumeMode: Filesystem
Did you find this article helpful?
If so, consider buying me a coffee over at