From 65d48949c5a0cc1941a98fcfa1698558dac7052a Mon Sep 17 00:00:00 2001 From: "Tsunghan (Robert) Liu" Date: Thu, 16 Jan 2025 13:32:16 +0800 Subject: [PATCH] increase ESP partition for compatibility When the ESP partition is 256MB and the disk is using 4K sector size, mkfs.fat will prompt: > WARNING: Number of clusters for 32 bit FAT is less than suggested minimum. Based on the implementation, the data area (i.e., **without** FAT32 header, reserved sectors and alignments/offset) should be larger than 65525 sectors. Therefore, 256MB is not enough for disks using 4K sector size. Use `truncate -s $((65696*4096)) part.bin; mkfs.fat -F 32 -S 4096 -v part.bin` to verify if the sector number is enough. By giving different FAT settings, the necessary size might by changed. For better compatibility and increasing 4MB doesn't consume a lot of disk space, it'd be good to have a bigger ESP partition. Reference: [1] mkfs.fat - https://github.com/dosfstools/dosfstools/blob/master/src/mkfs.fat.c [2] https://superuser.com/questions/1702331/what-is-the-minimum-size-of-a-4k-native-partition-when-formatted-with-fat32 Signed-off-by: Robert Liu --- gadget-amd64.yaml | 3 ++- gadget-arm64.yaml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gadget-amd64.yaml b/gadget-amd64.yaml index 59604db..63680a9 100644 --- a/gadget-amd64.yaml +++ b/gadget-amd64.yaml @@ -18,7 +18,8 @@ volumes: type: EF,C12A7328-F81F-11D2-BA4B-00A0C93EC93B filesystem: vfat filesystem-label: system-boot - size: 256M + min-size: 256M + size: 260M content: - source: shimx64.efi target: EFI/BOOT/BOOTX64.EFI diff --git a/gadget-arm64.yaml b/gadget-arm64.yaml index fbd11fe..6f96b17 100644 --- a/gadget-arm64.yaml +++ b/gadget-arm64.yaml @@ -6,7 +6,8 @@ volumes: type: EF,C12A7328-F81F-11D2-BA4B-00A0C93EC93B filesystem: vfat filesystem-label: system-boot - size: 256M + min-size: 256M + size: 260M content: - source: shimaa64.efi target: EFI/BOOT/BOOTAA64.efi