Resizing the boot partition on Fedora CoreOS
This covers the issue at installation time, and should be workable to resize even after the installation and the first boot. After the coreos installer runs, the layout of the partitions will include something like:
└ # gdisk -l /dev/sda
GPT fdisk (gdisk) version 1.0.10
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 1000215216 sectors, 476.9 GiB
Model: HUGWORLD SSD 512
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 9E151132-C6B9-4E44-92FD-60DB86CCB8BE
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1000215182
Partitions will be aligned on 16-sector boundaries
Total free space is 2669 sectors (1.3 MiB)
Number Start (sector) End (sector) Size Code Name
1 2048 4095 1024.0 KiB EF02 BIOS-BOOT
2 4096 264191 127.0 MiB EF00 EFI-SYSTEM
3 264192 786432 384.4 MiB 8300 boot
4 786833 9717247 2.4 GiB 8300 root
The root partition will be resized to its maximum size, after the reboot. This is the best time to shift it to the right and resize the boot partition.
Let’s assume you want to add 512M to the boot partition. We need to move the left boundary of the root partition to the right by 512M, and then resize the boot partition to the right by 512M.
Let’s calculate the new initial sector for the root partition:
512MB = 512 * 1024 * 1024 [B] / 512 [B/sector] = 1048576 sectors
NewSectorForRootPartition = 786833 + 1048576 = 1835409
At this point we can move the root partition to the right by 512M and resize the boot partition to the right by 512M:
echo "<NewSectorForRootPartition>, 4G" | sfdisk --move-data /dev/sda -N 4 # 4 is the root partition, on the right of the boot one to be resized
echo ", +" | sfdisk /dev/sda -N 3 # 3 is the boot partition. We will resize it to the right, until possible (512M)
e2fsck -f /dev/sda3
resize2fs /dev/sda3 # Resize the file system
Read other posts