EFI System Partition
EFI system partition (ESP) — это раздел, сформатированный в FAT и содержащий основные EFI загрузчики или образы ядер для установленных операционных систем.
Ядро
Должны быть включены параметры «Advanced partition selection» (CONFIG_PARTITION_ADVANCED) и «EFI GUID Partition support» (CONFIG_EFI_PARTITION):
-*- Enable the block layer --->
Partition Types --->
[*] Advanced partition selection
[*] EFI GUID Partition support
Также должна быть включена кодовая страница ISO8859-1 для того, чтобы монтировать FAT EFI-раздел:
-*- File Systems --->
DOS/FAT/EXFAT/NT Filesystems --->
<*> VFAT (Windows-95) fs support
(437) Default codepage for FAT
(iso8859-1) Default iocharset for FAT
Native Language support --->
[*] NLS ISO 8859-1 (Latin 1; Western European Languages)
Характеристики
Для инструкций по созданию обратитесь к Руководству.
parted (sys-block/parted) отобразит раздел вместе с флагами boot, esp:
root #
parted /dev/sda print
Model: ATA SAMSUNG SSD SM84 (scsi) Disk /dev/sda: 256GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 99.6MB 98.6MB fat32 EFI System Partition boot, esp
gdisk (sys-apps/gptfdisk) отобразит раздел с кодом EF00:
root #
gdisk -l /dev/sda
GPT fdisk (gdisk) version 1.0.1 Partition table scan: MBR: protective BSD: not present APM: not present GPT: present Found valid GPT with protective MBR; using GPT. Disk /dev/sda: 500118192 sectors, 238.5 GiB Logical sector size: 512 bytes Disk identifier (GUID): 1B59C2C8-8795-4625-9718-4D636B005AC1 Partition table holds up to 128 entries First usable sector is 34, last usable sector is 500118158 Partitions will be aligned on 2048-sector boundaries Total free space is 2669 sectors (1.3 MiB) Number Start (sector) End (sector) Size Code Name 1 2048 194559 94.0 MiB EF00 EFI System Partition
Файловая система раздела может быть создана с помощью команды mkfs.fat:
root #
mkfs.fat -F 32 /dev/sda1
Соображения по размеру
Руководство пользователя Gentoo рекомендует выделить 1 ГиБ для раздела ESP, чего более чем достаточно для любого загрузчика типа ядер с EFI stub или Windows.
Точка монтирования
Mounting the ESP to /boot/efi/, as was traditionally done, is not recommended. A nested setup complicates implementation of best-practice autofs-style mounts, as establishing the inner autofs will trigger the outer one. Mounting these partitions via autofs (and by extension keeping them unmounted whenever possible) is recommended due to the data integrity and security characteristics of VFAT file systems being effectively nonexistent.
Where bootloader support is available use /boot for the XBOOTLDR partition and /efi for the ESP. If it is not possible to do so, a monolithic ESP should be mounted at /boot; autofs-style mounts should still be used.
systemd, when partitions are configured according to the Discoverable Partitions Specification, can automatically mount the ESP used for the current boot to /boot or /efi unless a different partition is mounted there [possibly via /etc/fstab] or the mount point directory is not empty. If both ESP and XBOOTLDR exist, the /efi mount point is used.
For systemd (if not using the GPT auto generator):
UUID=56FE-81E0 /efi vfat defaults,noatime,uid=0,gid=0,umask=0077,x-systemd.automount,x-systemd.idle-timeout=600 0 2
For OpenRC, use AutoFS to mount on-demand:
root #
emerge --ask net-fs/autofs
Setup a Direct AutoFS Mount for the ESP.
/- /etc/autofs/auto.boot --timeout=600,sync,nodev
Tell AutoFS to watch for access to the paths /boot and /efi and mount them with options from device.
/boot -fstype=vfat,uid=0,gid=0,umask=0077 UUID=AB12-CD34
/efi -fstype=vfat,uid=0,gid=0,umask=0077 UUID=EF00-000A
AutoFS needs to be running to watch mountpoints:
root #
rc-update add autofs default
To use the automounter before rebooting, start it manually:
root #
/etc/init.d/autofs start
There is no need to add these partitions to /etc/fstab.
Стандартная конфигурация
Существует стандартная конфигурация для ESP. Производители оборудования и операционных систем должны размещать свои файлы в каталоги, специфичные для производителя.
user $
tree -L 3 /efi
/efi └── EFI ├── BOOT │ └── BOOTX64.EFI ├── Linux │ └── gentoo-x.y.z-dist.efi └── Microsoft ├── Boot └── Recovery
Здесь представлены подкаталоги Microsoft и Boot[1] — они были созданы ранее при установке ОС Windows 10. Подкаталог Boot является каталогом для сценариев по умолчанию. Если UEFI не может найти специфичных для производителя каталогов, он попытается загрузить систему отсюда. В мультизагрузочном окружении с корректно созданными подкаталогами производителей каталог Boot может быть удален.
Загрузочные записи UEFI
Компьютеры с поддержкой UEFI обычно предоставляют меню загрузки и конфигурационную утилиту для создания, сортировки и удаления загрузочных записей. Содержимое ESP доступно этим инструментам, поэтому создание загрузочной записи является ничем иным как выбор доступного носителя, просмотр ESP и выбор необходимой записи, например bzImage-4.9.76-r1-gentoo.efi.
В качестве альтернативе, для создания загрузочных записей UEFI можно использовать efibootmgr.
Смотрите также
- Руководство пользователя AMD64: что такое EFI System Partition (ESP)?
- UEFI — a firmware standard for boot ROM designed to provide a stable API for interacting with system hardware. On x86 it replaced the legacy BIOS.
- EFI stub — provides instructions on configuring and installing kernels in the EFI System Partition (ESP) of a computer running in EFI mode.
- efibootmgr — приложение для управления загрузочными записями UEFI.
- REFInd — a boot manager for EFI and UEFI platforms forked from and successor to rEFIt.