EFI system partition explained

The EFI (Extensible Firmware Interface) system partition or ESP is a partition on a data storage device (usually a hard disk drive or solid-state drive) that is used by computers that have the Unified Extensible Firmware Interface (UEFI). When a computer is booted, UEFI firmware loads files stored on the ESP to start operating systems and various utilities.

An ESP contains the boot loaders, boot managers, or kernel images of installed operating systems (which are typically contained in other partitions), device driver files for hardware devices present in a computer and used by the firmware at boot time, system utility programs that are intended to be run before an operating system is booted, and data files such as error logs.[1]

Overview

The EFI system partition is formatted with a file system whose specification is based on the FAT file system and maintained as part of the UEFI specification; therefore, the file system specification is independent from the original FAT specification. The actual extent of divergence is unknown:[2] Apple maintains a separate tool that should be used on Intel/x86-64 Macs,[3] while other systems use FAT utilities just fine.[4] The globally unique identifier (GUID) for the EFI system partition in the GUID Partition Table (GPT) scheme is, while its ID in the master boot record (MBR) partition-table scheme is . Both GPT- and MBR-partitioned disks can contain an EFI system partition, as UEFI firmware is required to support both partitioning schemes. Also, El Torito bootable format for CD-ROMs and DVDs is supported.

UEFI provides backward compatibility with legacy systems by reserving the first block (sector) of the partition for compatibility code, effectively creating a legacy boot sector. On legacy BIOS-based systems, the first sector of a partition is loaded into memory, and execution is transferred to this code. UEFI firmware does not execute the code in the MBR, except when booting in legacy BIOS mode through the Compatibility Support Module (CSM).

The UEFI specification requires MBR partition tables to be fully supported. However, some UEFI implementations immediately switch to the BIOS-based CSM booting upon detecting certain types of partition table on the boot disk, effectively preventing UEFI booting from being performed from EFI system partitions contained on MBR-partitioned disks.[5]

UEFI firmware supports booting from removable storage devices such as USB flash drives. For that purpose, a removable device is formatted with a FAT12, FAT16 or FAT32 file system, while a boot loader needs to be stored according to the standard ESP file hierarchy, or by providing a complete path of a boot loader to the system's boot manager. On the other hand, FAT32 is always expected on fixed drives.

Usage

Linux

GRUB 2, elilo and systemd-boot serve as conventional, full-fledged standalone UEFI boot managers (a.k.a. bootloader managers) for Linux. Once loaded by a UEFI firmware, they can access and boot kernel images from all devices, partitions and file systems they support, without being limited to the EFI system partition.

The mount point for the EFI system partition varies depending on the bootloader used. Older bootloaders such as GRUB 2 and lilo/elilo default to /boot/efi. Alternatively, systemd-boot prefers either /efi or /boot over /boot/efi due to potential complications with nested autofs mounts. Regardless of the mount point path, its contents are accessible after Linux is booted.[6] [7]

Linux Kernel EFI Boot Stub

EFI Boot Stub makes it possible to boot a Linux kernel image without the use of a conventional UEFI boot loader. By masquerading as a PE/COFF executable image and appearing to the firmware as a UEFI application, a Linux kernel image with EFI Boot Stub enabled can be directly loaded and executed by a UEFI firmware. Such kernel images can still be loaded and run by BIOS-based boot loaders; thus, EFI Boot Stub allows a single kernel image to work in any boot environment.[8]

Linux kernel's support for the EFI Boot Stub is enabled by turning on option CONFIG_EFI_STUB (EFI stub support) during the kernel configuration.[9] It was merged into version 3.3 of the Linux kernel mainline, released on March 18, 2012.[10]

Systemd-boot is a simple UEFI boot manager that loads and runs configured EFI images, accessing only the EFI system partition. Configuration file fragments, kernel images and initrd images are required to reside on the EFI system partition, as systemd-boot does not provide support for accessing files on other partitions or file systems. Linux kernels need to be built with CONFIG_EFI_STUB=y so they can be directly executed as UEFI images.[11]

Apple

macOS on Intel (x86 and x86-64)

On Apple Mac computers using Intel x86-64 processor architecture, the EFI system partition is initially left blank and unused for booting into macOS.[12] [13]

However, the EFI system partition is used as a staging area for firmware updates[14] and for the Microsoft Windows bootloader for Mac computers configured to boot into a Windows partition using Boot Camp.[15]

Custom Apple UEFI firmware named iBoot controls the logic for finding and loading bootloaders. iBoot will select the desired bootloader (potentially configured via Startup Keyboard Combinations or NVRAM), optionally falling back to either the internal macOS Installation, or a recovery system called recoveryOS.[16]

Older pre-UEFI Apple–Intel architecture machines required the EFI system partition to be formatted in HFS+. Third-party bootloaders needed to be "blessed" by a special ioctl command before becoming bootable by the firmware, a relic of the System Folder blessing from Classic Mac OS. There are otherwise no limitations to what kinds of EFI operating system or bootloader an Intel-based Apple computer can run.[17] [18]

iOS, iPadOS, macOS on Apple silicon (AArch64)

Devices using Apple silicon (AArch64) such as iPhones, iPads and all Mac computers from 2023 onward do not contain EFI/UEFI functionality and subsequently do not use EFI system partitions.[19] [20]

Windows

UEFI support in Windows began in 2008 with Windows Vista® SP1.[21]

The Windows boot manager is located at the subfolder of the EFI system partition.[22]

On Windows XP 64-Bit Edition and later, access to the EFI system partition is obtained by running the command. Mounts the EFI system partition on the specified drive. Available on Itanium-based computers only.[23]

See also

External links

Notes and References

  1. Web site: Unified Extensible Firmware Interface (UEFI) Specification (versions 2.10 and older) . August 2022 . 2022-12-12 . UEFI.org . PDF.
  2. Web site: UEFI Specification Version 2.5, Section 12.3 File System Format . April 2015 . 2015-05-29 . UEFI.org . PDF . 536, 537 . The file system supported by the Extensible Firmware Interface is based on the FAT file system. EFI defines a specific version of FAT that is explicitly documented and testable. Conformance to the EFI specification and its associate reference documents is the only definition of FAT that needs to be implemented to support EFI. To differentiate the EFI file system from pure FAT, a new partition file system type has been defined..
  3. Web site: Technical Note TN2166: Secrets of the GPT . 2006-11-06 . 2015-05-06 . Developer.Apple.com.
  4. Web site: EFI system partition . ArchWiki . 14 March 2020.
  5. Web site: UEFI system booting from MBR partition table and GRUB legacy . June 2012 . 2013-10-06 . ArchLinux.org.
  6. Web site: 2013-12-21 . UEFI - Community Ubuntu Documentation . 2013-12-27 . Ubuntu.com.
  7. Web site: Boot Loader Specification . 2024-02-15 . uapi-group.org . en.
  8. Web site: 2014-06-16 . The EFI Boot Stub - The Linux Kernel Documentation . live . https://web.archive.org/web/20231004135314/https://docs.kernel.org/admin-guide/efi-stub.html . 2023-10-04 . 2024-02-14 . The Linux Kernel documentation.
  9. Web site: Linux kernel 3.11.1 arch/x86/Kconfig: CONFIG_EFI_STUB (line #1575) . 2013-10-06 . Kernel.org.
  10. Web site: Linux kernel 3.3: 1.10. EFI boot support . 2012-03-18 . 2013-10-06 . KernelNewbies.org.
  11. Web site: 2021-05-07 . systemd-boot UEFI Boot Manager . live . https://web.archive.org/web/20240214190517/https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/ . 2024-02-14 . 2024-02-14 . Freedesktop.org.
  12. Web site: rEFIt: Myths and Facts About Intel Macs – Myth: Mac OS X Requires a Hidden EFI System Partition. rEFIt.SourceForge.net.
  13. Web site: Boot process for an Intel-based Mac . 2024-02-14 . Apple Support . en.
  14. Web site: Firmware updates for Intel-based Macs require a GUID partition scheme. Apple Knowledgebase.
  15. Web site: Boot modes of an Intel-based Mac with an Apple T2 Security Chip . 2024-02-14 . Apple Support . en.
  16. Web site: Startup Security Utility on a Mac with an Apple T2 Security Chip . 2024-02-14 . Apple Support . en.
  17. Web site: 7 September 2014 . Ubuntu + Mac: Pure EFI Boot . dead . https://web.archive.org/web/20210308000444/https://heeris.id.au/2014/ubuntu-plus-mac-pure-efi-boot/#fixing-efi . 8 March 2021 . 17 November 2019 . The Slightly Disgruntled Scientist.
  18. Web site: BLESS(8) . 2024-02-14 . keith.github.io.
  19. Web site: 2023-11-02 . Introduction to Apple Silicon: Storage . live . https://web.archive.org/web/20240214214100/https://github.com/AsahiLinux/docs/wiki/Introduction-to-Apple-Silicon#storage . 2024-02-14 . 2024-02-14 . GitHub - Asahi Linux Wiki . en.
  20. Web site: Boot process for a Mac with Apple silicon . 2024-02-14 . Apple Support . en.
  21. Web site: UEFI and Windows . Windows Hardware Developer Central (WHDC) . Microsoft Corporation. . May 5, 2024 . https://web.archive.org/web/20090104140919/http://www.microsoft.com/whdc/system/platform/firmware/UEFI_Windows.mspx . January 4, 2009 . July 24, 2008.
  22. Web site: Subdirectory Registry Unified Extensible Firmware Interface Forum . uefi.org . UEFI Forum . 5 May 2024.
  23. Web site: Mountvol . Windows Server 2012 R2 and Windows Server 2012 . learn.microsoft.com . 5 May 2024 . en-us . 31 August 2016.