11

Suppose I have a flash drive, and I want it to be bootable. Suppose I also have a basic EFI file which will accomplish something. So, what is the minimum size the ESP can be? I've read that it's 100MB, but that seems to be specifically in regards to windows. Must a EFI partition be a certain size for the system to recognize it? Or is 100 just recommended because modern operating systems use that much?

11

Is 100 just recommended because modern operating systems use that much?

Note that the 100 MB partition size is the minimum. Though there is no specification set by UEFI for a minimum size, but Microsoft recommends this 100 MB size for it's Operating Systems.

Let's think we need the EFI partition to be formatted using the FAT32 file system. The minimum partition size of FAT32 drive is calculated as sector_size x 65527.

In Advanced Format 4K Native drives, there is 4 KB per sector. In that case, the minimum partition size for FAT32 drive is calculated as 4 KB x 65527 = 256 MB. That's why recommended minimum size for 4K drives is 260 MB.

But in Advanced Format 512e drives, the emulated sector size is 512 bytes. In that case, the minimum partition size for FAT32 drive is calculated as 512 bytes x 65527 = 32 MB, which is less than the 100 MB minimum size for this partition.

Must a EFI partition be a certain size for the system to recognize it?

Though Microsoft recommends 100 MB for its operating systems, the Linux forums suggest more for Linux based operating systems or for any dual boot or multi booting situations.

The author of gdisk suggests 550 MiB.

As per the Arch Linux forum, to avoid potential problems with some EFIs, ESP size should be at least 512 MiB. 550 MiB is recommended to avoid MiB/MB confusion and accidentally creating FAT16.

So, most common size guideline for EFI System Partition is between 100 MB to 550 MB. One of the reason behind this is it is difficult to resize later as it is the first partition on the drive. EFI partition may contain languages, fonts, BIOS firmware, other firmware related staffs. There are some firmware/software that are installed into the the EFI partition instead of the data drive. And there are some that want the capability in the future to add things into ESP.

As it may be difficult to enlarge the size in case it is needed later and the Hard Disk size now a days is larger, a big number of size like 100 MB or 550 MB is recommended for ESP. But in general case, it uses only some Kilo Bytes of space.

Suppose I have a flash drive, and I want it to be bootable.

Though it is not clear from your statement, if you try to make your pen drive bootable as UEFI compatible drive for windows installation, then there is no need of creating extra ESP in the pen drive. Use rufus or similar tools which will take care of converting it into UEFI enabled drive. But ESP is needed in your hard drive when installing windows into that drive.

  • I am not looking into installing windows - I am creating my own bootloader, just for fun. It currently works with MBR, I just wanted to know what the absolute minimum size the ESP could be was. – MazeOfEncryption Apr 5 '18 at 17:31
  • The EFI partition is needed to be formatted using the FAT32 file format this is wrong in many levels: The ESP doesn't need to be FAT32, and FAT32 is a partition format, not file format. Unfortunately, many Linux installers create FAT16 ESPs by default and my laptop's preinstalled Linux is one of them. In fact I've seen FAT16 more common on Linux than FAT32 – phuclv Jan 27 '19 at 8:49
  • 2
    Old post, I know, but just to add that FreeBSD uses an 800KiB EFI partition for its bootable installation media. Obviously you are not usually adding stuff to the EFI partition on a USB stick after creating it, so you can get away with making it as small as technically possible. On the other hand, on your main system disk you should leave sufficient breathing room on the EFI partition to allow for future content. – dumetrulo Mar 13 '19 at 9:34
4

The absolute minimum size you can get away with, involves using a fat12 filesystem (so 32 KB), and in practice requires using some minimal boot manager that incorporates filesystem drivers for reading your primary partition -- and the kernel contained there -- which implies grub or rEFInd. A typical grub-install image will be around 200KB, which is still not bad at all.

I've been booting just fine with a 2MB fat12 ESP for quite some time now, so clearly it can be done!

I'm not entirely sure where the common advice to use 512MB comes from, but the Arch Wiki was recently amended by... me... to reference the possibility of fat12.

http://www.rodsbooks.com/linux-uefi/ seems to indicate at least fat16 should work fine except for confusing the Windows installer, which is not really relevant IMHO. The Arch Wiki seems to have based itself on that advice, but I'm not brave enough to totally rewrite it.

As I referenced in the Wiki, the UEFI spec mandates fat12 drivers. I've heard arguments that "only removable drives are mandated", leaving open the possibility that someone, somewhere, has or will write a UEFI implementation that includes those fat12 filesystem drivers but somehow forbids their use for mounting the UEFI system partition, but I personally consider this unlikely.

  • For Arch the Parted page suggests 260MiB as the recommended minimum whereas Encrypting an entire system says 200MiB is all that's needed. Perhaps separate page describing the considerations would be welcomed, and wouldn't require a rewrite. – Josh Habdas Dec 19 '19 at 1:21
3

For Linux, in terminal, run sudo fdisk -l to find out the sector size of your storage drive.

Since the EFI partition is formatted as FAT32, the minimum partition size of FAT32 drive is calculated as sector_size x 65527. For modern storage that is 512 bytes x 65527 = 32 MiB. The EFI boot manager executable is around 125 KiB, so the 32 MiB minimum is more than necessary for the EFI partition size. There are other arguments for larger sizes, but unless you run in those particular situations, larger is not necessary.

  • the EFI on Linux is often FAT16, not FAT32. And as mentioned by eschwartz even FAT12 will also work – phuclv May 25 '19 at 7:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.