Skip to content

Docs CSC now features an automatic Finnish translation. Click here for more information.

Warning!

Puhti and Mahti will be decommissioned after Roihu becomes available. Users should clean up unnecessary files and move any required data by the end of August 2026. See the Roihu data preparation instructions for details.

Puhti scratch is very full: keep only active data there and move or delete everything else. No new Puhti scratch quota will be granted.

Expand a volume

As dynamic volume expansion is not activated, if one edits directly in the YAML object the size of the volume, an error like this will be returned:

(...)
# * spec: Forbidden: spec is immutable after creation except resources.requests for bound claims
(...)

When increasing the size of a PersistentVolumeClaim (PVC), it's recommended to use sizes that are multiples of 8 GiB (e.g., 16 GiB, 32 GiB, 64 GiB, 128 GiB, etc.).
Other values may not work and the size increase may silently fail.

Then a more artisanal procedure must be followed:

  • Create a new volume with the desired size

Create a new volume

  • Scale down the deployment that mounts the volume that is being resized.

Scale down

  • Mount the old and new volume in another Pod. The best option is to create a new deployment, create a file called two-volumes.yaml and replace the names of both volumes:
apiVersion: apps/v1
kind: Deployment
metadata:
  name: two-volumes
spec:
  replicas: 1
  selector:
    matchLabels:
      app: two-volumes
  template:
    metadata:
      labels:
        app: two-volumes
    spec:
      containers:
      - image: cscfi/nginx-okd:plus
        name: two-volumes
        ports:
        - containerPort: 8081
          protocol: TCP
        volumeMounts:
        - mountPath: /new
          name: new-volume
        - mountPath: /old
          name: old-volume
      volumes:
      - name: new-volume
        persistentVolumeClaim:
          claimName: new-volume
      - name: old-volume
        persistentVolumeClaim:
          claimName: old-volume
oc create -f two-volumes.yaml
  • Sync the data
oc rsh deploy/two-volumes rsync -vrlpD /old/ /new/
  • Delete that new Pod
oc delete deploy/two-volumes
  • Exchange volumes in the deployment that was mounting the volume, it is at template > spec > volumes under claimName.
oc edit deploy/<name of deployment>
  • Finally scale up the deployment.

In order to check the procedure worked, you may enter in a Pod that is mounting the volume and check the new size.