Blog

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

1
tdnf install gptfdisk -y

Run it on the disk

1
gdisk /dev/sda

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

List the root partition’s info:

1
Command (? for help): i
1
Partition number (1-2): 2
1
2
3
4
5
6
7
8
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

1
2
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

1
2
3
4
5
6
7
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

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

Resize filesystem

Reread the partition table and resize the partition:

1
2
3
partx -u /dev/sda
 
resize2fs /dev/sda2

Check your new partition size:

1
df -h