https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=290857

            Bug ID: 290857
           Summary: The ESP on FreeBSD Should Be FAT32 Instead of FAT16:
                    D28897 Is Actually Ineffective
           Product: Base System
           Version: 15.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: [email protected]
          Reporter: [email protected]

Background: According to the UEFI specification
([https://uefi.org/specs/UEFI/2.11/13_Protocols_Media_Access.html](https://uefi.org/specs/UEFI/2.11/13_Protocols_Media_Access.html)),
section 13.3 “File System Format,” system drives such as SSDs or HDDs should
use FAT32. Only removable media are allowed to use FAT16 or FAT12. In fact,
this is also a discouraged practice — UEFI recommends using FAT32 whenever
possible:

"EFI encompasses the use of FAT32 for a system partition, and FAT12 or FAT16
for removable media. The FAT32 system partition is identified by an OSType
value other than that used to identify previous versions of FAT. This unique
partition type distinguishes an EFI defined file system from a normal FAT file
system. The file system supported by EFI includes support for long file names."

---------------------

According to
[https://reviews.freebsd.org/D28897](https://reviews.freebsd.org/D28897) and
[https://cgit.freebsd.org/src/tree/usr.sbin/bsdinstall/scripts/zfsboot](https://cgit.freebsd.org/src/tree/usr.sbin/bsdinstall/scripts/zfsboot),
the partition editor will reuse an existing ESP; otherwise, it will create one
and format it as FAT32.

--------------

According to `NEWFS_ESP='newfs_msdos "%s"'`, `"$align_small" efiboot$index efi
260M \`, and the source code of `newfs_msdos`
([https://cgit-dev.freebsd.org/src-test/plain/sbin/newfs_msdos/mkfs_msdos.c?h=main](https://cgit-dev.freebsd.org/src-test/plain/sbin/newfs_msdos/mkfs_msdos.c?h=main)),
the result of running `newfs_msdos` on a 260M partition is always FAT16 unless
the `-F 32` option is specified. However, due to incorrect cluster allocation,
it is effectively impossible to manually reformat it as FAT32.

---------------

root@ykla:/home/ykla/FreeBSD-Ask/netbsd/src # gpart show
=>       40  209715120  nda0  GPT  (100G)
         40     532480     1  efi  (260M)
     532520       1024     2  freebsd-boot  (512K)
     533544        984        - free -  (492K)
     534528    4194304     3  freebsd-swap  (2.0G)
    4728832  204984320     4  freebsd-zfs  (98G)
  209713152       2008        - free -  (1.0M)

root@ykla:/home/ykla/FreeBSD-Ask/netbsd/src # file -s /dev/nda0p1
/dev/nda0p1: DOS/MBR boot sector, code offset 0x3c+2, OEM-ID "BSD4.4  ",
sectors/cluster 32, root entries 512, sectors/FAT 65, sectors/track 63, heads
255, sectors 532480 (volumes > 32 MB), serial number 0x40cc140d, unlabeled, FAT
(16 bit)

root@ykla:~ # newfs_msdos -F 32 /dev/nvd0p1
newfs_msdos: 16630 clusters too few clusters for FAT32, need 65525

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to