uncategorized

Resize Photon Root Disk

I use the Photon minimal distribution quite extensively. It does come with a tiny disk size of 8GB. This is a writeup of the detailed instructions of this original post: https://communities.vmware.com/thread/521416.

Install gpart

tdnf install gptfdisk -y

Run it on the disk

gdisk /dev/sda

List the root partition’s info and copy the unique GUID

List the root partition’s info:

Command (? for help): i
Partition number (1-2): 2
Partition number (1-2): 2
Partition GUID code: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 (Linux filesystem)
Partition unique GUID: DB3788E4-5613-4E7A-820B-15E269340E29
First sector: 6144 (at 3.0 MiB)
Last sector: 16777182 (at 8.0 GiB)
Partition size: 16771039 sectors (8.0 GiB)
Attribute flags: 0000000000000000
Partition name: ''

Now delete the root partition

Command (? for help): d
Partition number (1-2): 2

Now make a new partition with the default parameters.  It should fill all available space with the defaults

Command (? for help): n
Partition number (2-128, default 2): 2
First sector (34-52428766, default = 6144) or {+-}size{KMGTP}:
Last sector (6144-52428766, default = 52428766) or {+-}size{KMGTP}:
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'

Enter the partition’s new unique GUID

Copy the GUID from before to the new partition you just created

x<enter>c<enter>2<enter>DB3788E4-5613-4E7A-820B-15E269340E29<enter>
w<enter>y<enter>

Resize filesystem

Reread the partition table and resize the partition:

partx -u /dev/sda
 
resize2fs /dev/sda2

Check your new partition size:

df -h