How to extend space for a OCP /sysroot mounted for /

The current disk size is 64 GB and disk was extended from VMware end, Now time to extend from RedHat OpenShift side.

We are getting below package from the app-stream repository rhel-8-for-x86_64-appstream-rpms, make sure to install it.

$ dnf -y install cloud-utils-growpart

Grow the partition by running growpart command.

$ growpart /dev/sda 4

Run from privileged user.

$ sudo su –

Run program with some namespaces unshared from parent

$ unshare --mount

Mount it with read and write

$ mount -o remount,rw /sysroot

Grow the filesystem.

$ xfs_growfs /sysroot

That’s it the /sysroot filesystem has been extended.