Bootstrap FreeKB - OpenShift - Resize Persistent Volume Claim available storage
OpenShift - Resize Persistent Volume Claim available storage

Updated:   |  OpenShift articles

If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.

A persistent volume (PV) is the "physical" volume (such as a hard disk drive or solid state drive) on the host machine (node) that stores your persistent data, whereas a persistent volume claim (PVC) is a reference to a persistent volume, used by a pod.

 

Let's say you have a Persistent Volume Claim that has 1Gi of available storage and you want to increase to 2Gi.

~]$ oc get pvc --output wide
NAME                         STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE      VOLUMEMODE
my-persistent-volume-claim   Bound    pvc-2db07c57-e282-48e7-bfb1-4cbd7245c25e   1Gi        RWO            file-storage   3m29s    Filesystem

 

The oc get persistentvolumes (or oc get pv) command can be used to show the Storage Class being used by the Persistent Volume.

~]$ oc get pv pvc-2db07c57-e282-48e7-bfb1-4cbd7245c25e
NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                            STORAGECLASS   REASON   AGE
pvc-2db07c57-e282-48e7-bfb1-4cbd7245c25e   1Gi        RWO            Delete           Bound    foo/my-persistent-volume-claim   file-storage            19m

 

The oc get storageclass command can be used to determine if the Storage Class allows volume expansion.

~]$ oc get storageclass
NAME                     PROVISIONER                    RECLAIMPOLICY   VOLUMEBINDINGMODE   ALLOWVOLUMEEXPANSION   AGE
file-storage (default)   csi.trident.netapp.io          Delete          Immediate           true                   377d
thin                     kubernetes.io/vsphere-volume   Delete          Immediate           false                  381d

 

If the storage class allows volume expansion and is file system storage, the oc edit persistentvolumeclaim command can be used to update the amount of storage being used by the Persistent Volume Claim. The oc get events command should return something like this.

Events:
  Type     Reason                  Age   From                                    Message
  ----     ------                  ----  ----                                    -------
  Normal   Resizing                15s   external-resizer csi.trident.netapp.io  External resizer is resizing volume pvc-2db07c57-e282-48e7-bfb1-4cbd7245c25e
  Normal   VolumeResizeSuccessful  14s   external-resizer csi.trident.netapp.io  Resize volume succeeded

 

And then the Persistent Volume Claim should be 2Gi.

~]$ oc get pvc --output wide
NAME                         STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE      VOLUMEMODE
my-persistent-volume-claim   Bound    pvc-2db07c57-e282-48e7-bfb1-4cbd7245c25e   2Gi        RWO            file-storage   3m29s    Filesystem

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 8d4b55 in the box below so that we can be sure you are a human.