Photon OS 3.0 – Resize the OS system disk

Let’s go through how to resize the Photon OS system disk. This is a fairly simple task but all the posts I found about doing this seemed to miss something along the way so here goes. This can be done while the VM is powered on.

First up, resize the disk in vCenter. Got to the VM and edit its settings.

Increase the size and click OK. It should only take a second or two to perform the update and in the recent tasks you should see the task completed.

Next up, SSH as root into the VM.
df -l
to see your current configuration. I am increasing from 50GB to 55GB for this walk through and below you can see my 50GB disk before we increase it’s size.

Rescan the SCSI bus for changes to the disks.
echo 1 > /sys/class/block/sda/device/rescan
and then
fdisk -l
to see the current partitions. You will notice the mismatch errors and the disk showing 55GB but the partition shows 50GB.

We are going to be increasing the size of /dev/sda3
If you don’t have parted installed do this now.
tdnf update
tdnf install parted
Next resize the partition
parted /dev/sda
print

When you are asked if you want to Fix/Ignore, type in Fix. You will then notice partition 3 is now increased to 53.7GB
Do the resize and let it consume all 100% of the available space.
resizepart 3 yes 100%

Exit parted
quit
and finally resize the file system.
resize2fs /dev/sda3

df -l
to see the updated size