Page MenuHomeFreeBSD

Increase partition limit size for boot code
AcceptedPublic

Authored by scottl on Aug 17 2021, 6:29 PM.

Details

Reviewers
loos
imp
gjb
brd
Group Reviewers
pfsense
Summary

From Luiz at Netgate

Increase the arbitrary limit of gpart partboot code to 128MiB. New hardware requires a bigger EFI partition to allow for the BIOS update. The partboot code size is further limited by the partition size in gpart_write_partcode() (as stated by gpart(8)).

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

scottl created this revision.
This revision is now accepted and ready to land.Aug 17 2021, 6:30 PM

While this limit is arbitrary (so I don't object to the change), EFI is no longer updated with gpart bootcode. It's a FAT partition that can be made to be an arbitrary size and updated with mount + cp, etc or mtools.
bsdinstall has been making several hundred MB files partitions without this since we've killed boot1.efifat.
Even for stable branches, users requiring larger boot partitions have been encouraged just to mount it as a FAT and write the new *.efi files.

Just for additional info TrueNAS moved to 260MB about 4 years ago with no issues. I have no issue with 100MB though 260MB seems to be more standard.(windows/redhat/TrueNAS/etc)

@mav
Put this comment in when we did it.

260MB is the minimal FAT32 size on 4Kn disks, and the size used by Microsoft
even on disks with 512 byte sectors.  While at this moment we use FAT16, this
change could be unnecessary to support 4Kn disks, but there seem to be a bug
in newfs_msdosfs cluster size choosing logic, failing the FS creation.

This change should make us more future-proof, while slightly increase boot
disk size requirements and possibly cause some issues with adding new disks
of the same size into old boot pool, since now data partition is slightly
smaller.  It is probably better to bump it now while UEFI is less spread.

https://github.com/truenas/middleware/commit/6a9324bbe9c72350d23ac21ae694b4c877e7dd50

Just for additional info TrueNAS moved to 260MB about 4 years ago with no issues. I have no issue with 100MB though 260MB seems to be more standard.(windows/redhat/TrueNAS/etc)

FreeBSD doesn't use this for anything anymore, so it's likely best to just commit this as is (or just drop the change entirely) since the limit is arbitrary. gpart bootcode is unused for UEFI since FreeBSD 12.x: the FAT partition is created with makefs_msdos and managed by mounting it and copying files into it.