Системный раздел efi linux

EFI system partition

The EFI system partition (also called ESP) is an OS independent partition that acts as the storage place for the EFI bootloaders, applications and drivers to be launched by the UEFI firmware. It is mandatory for UEFI boot.

This article or section is a candidate for moving to Unified Extensible Firmware Interface#UEFI drivers.

The UEFI specification mandates support for the FAT12, FAT16, and FAT32 file systems (see UEFI specification version 2.8, section 13.3.1.1), but any conformant vendor can optionally add support for additional file systems; for example, the firmware in Apple Macs supports the HFS+ file system.

Contents

Check for an existing partition

If you are installing Arch Linux on an UEFI-capable computer with an installed operating system, like Windows 10 for example, it is very likely that you already have an EFI system partition.

To find out the disk partition scheme and the system partition, use fdisk as root on the disk you want to boot from:

The command returns:

  • The disk’s partition table: it indicates Disklabel type: gpt if the partition table is GPT or Disklabel type: dos if it is MBR.
  • The list of partitions on the disk: Look for the EFI system partition in the list, it is usually at least 100 MiB in size and has the type EFI System or EFI (FAT-12/16/32) . To confirm this is the ESP, mount it and check whether it contains a directory named EFI , if it does this is definitely the ESP.

If you found an existing EFI system partition, simply proceed to #Mount the partition. If you did not find one, you will need to create it, proceed to #Create the partition.

Create the partition

The following two sections show how to create an EFI system partition (ESP).

To provide adequate space for storing boot loaders and other files required for booting, and to prevent interoperability issues with other operating systems[1][2] the partition should be at least 260 MiB. For early and/or buggy UEFI implementations the size of at least 512 MiB might be needed.[3]

GPT partitioned disks

EFI system partition on a GUID Partition Table is identified by the partition type GUID C12A7328-F81F-11D2-BA4B-00A0C93EC93B .

Choose one of the following methods to create an ESP for a GPT partitioned disk:

  • fdisk: Create a partition with partition type EFI System .
  • gdisk: Create a partition with partition type EF00 .
  • GNU Parted: Create a partition with fat32 as the file system type and set the esp flag on it.

Proceed to #Format the partition section below.

MBR partitioned disks

EFI system partition on a Master Boot Record partition table is identified by the partition type ID EF .

Choose one of the following methods to create an ESP for a MBR partitioned disk:

  • fdisk: Create a primary partition with partition type EFI (FAT-12/16/32) .
  • GNU Parted: Create a primary partition with fat32 as the file system type and set the esp flag on it.

Proceed to #Format the partition section below.

Format the partition

The UEFI specification mandates support for the FAT12, FAT16, and FAT32 file systems[4]. To prevent potential issues with other operating systems and also since the UEFI specification only mandates supporting FAT16 and FAT12 on removable media[5], it is recommended to use FAT32.

Читайте также:  Ошибка 0х80070643 при обновлении windows 10

After creating the partition, format it as FAT32. To use the mkfs.fat utility, install dosfstools .

If you get the message WARNING: Not enough clusters for a 32 bit FAT! , reduce cluster size with mkfs.fat -s2 -F32 . or -s1 ; otherwise the partition may be unreadable by UEFI. See mkfs.fat(8) for supported cluster sizes.

Mount the partition

The kernels, initramfs files, and, in most cases, the processor’s microcode, need to be accessible by the boot loader or UEFI itself to successfully boot the system. Thus if you want to keep the setup simple, your boot loader choice limits the available mount points for EFI system partition.

Typical mount points

The simplest scenarios for mounting EFI system partition are:

  • mount ESP to /efi and use a boot loader which is capable of accessing the kernel(s) and initramfs image(s) that are stored elsewhere (typically /boot). See Arch boot process#Boot loader for more information on boot loader requirements and capabilities.
  • mount ESP to /boot . This is the preferred method when directly booting an EFISTUB kernel from UEFI or booting it via a boot manager like systemd-boot.
  • mount ESP to /efi and additionally mount an «Extended Boot Loader Partition» (XBOOTLDR) to /boot . This can be useful when a previously created ESP is too small to hold multiple boot loaders and/or kernels but the ESP cannot be easily resized (such as when installing Linux after Windows to dual boot). This method is supported by at least systemd-boot.

Alternative mount points

If you do not use one of the simple methods from #Typical mount points, you will need to copy your boot files to ESP (referred to hereafter as esp ).

Furthermore, you will need to keep the files on the ESP up-to-date with later kernel updates. Failure to do so could result in an unbootable system. The following sections discuss several mechanisms for automating it.

Using bind mount

Instead of mounting the ESP itself to /boot , you can mount a directory of the ESP to /boot using a bind mount (see mount(8) ). This allows pacman to update the kernel directly while keeping the ESP organized to your liking.

Just like in #Alternative mount points, copy all boot files to a directory on your ESP, but mount the ESP outside /boot . Then bind mount the directory:

After verifying success, edit your Fstab to make the changes persistent:

Using systemd

Systemd features event triggered tasks. In this particular case, the ability to detect a change in path is used to sync the EFISTUB kernel and initramfs files when they are updated in /boot/ . The file watched for changes is initramfs-linux-fallback.img since this is the last file built by mkinitcpio, to make sure all files have been built before starting the copy. The systemd path and service files to be created are:

Then enable and start efistub-update.path .

Using filesystem events

Filesystem events can be used to run a script syncing the EFISTUB Kernel after kernel updates. An example with incron follows.

In order to use this method, enable the incrond.service .

Using mkinitcpio hook

Mkinitcpio can generate a hook that does not need a system level daemon to function. It spawns a background process which waits for the generation of vmlinuz , initramfs-linux.img , and initramfs-linux-fallback.img before copying the files.

Add efistub-update to the list of hooks in /etc/mkinitcpio.conf .

Using mkinitcpio preset

As the presets in /etc/mkinitcpio.d/ support shell scripting, the kernel and initramfs can be copied by just editing the presets.

Replacing the above mkinitcpio hook

Edit the file /etc/mkinitcpio.d/linux.preset :

To test that, just run:

Another example

Using pacman hook

A last option relies on the pacman hooks that are run at the end of the transaction.

Читайте также:  Media foundation windows server

The first file is a hook that monitors the relevant files, and it is run if they were modified in the former transaction.

The second file is the script itself. Create the file and make it executable:

Troubleshooting

ESP on software RAID1

It is possible to make the ESP part of a RAID1 array, but doing so brings the risk of data corruption, and further considerations need to be taken when creating the ESP. See [8] and [9] for details and UEFI booting and RAID1 for an in-depth guide with a solution.

The key part is to use —metadata 1.0 in order to keep the RAID metadata at the end of the partition, otherwise the firmware will not be able to access it:

Источник

EFI system partition (Русский)

Системный раздел EFI (также называемый ESP или EFISYS) представляет собой физический раздел в формате FAT32 (в основной таблице разделов диска, а не под LVM или программным RAID и т.д.), откуда прошивка UEFI запускает загрузчик и приложение UEFI.

Это независимый от ОС раздел, который служит местом хранения загрузочных устройств EFI и приложений, которые будут запускаться с помощью прошивки EFI. Это необходимо для загрузки UEFI.

Contents

Создание раздела

В следующих двух разделах показано, как создать системный раздел EFI (ESP).

Рекомендуется сохранять размер ESP на 512 Мбайт, хотя меньшие/большие размеры тоже приветствуются. [1]

Согласно примечанию Microsoft[2], минимальный размер для системного раздела EFI (ESP) будет составлять 100 МБ, хотя это не указано в спецификации UEFI. Обратите внимание, что для дисков расширенный формат 4K Native drives (4 КБ на сектор) размер составляет не менее 256 Мбайт, поскольку это минимальный размер раздела дисков FAT32 (рассчитанный как размер сектора (4 КБ) x 65527 = 256 Мбайт), из-за ограничений файловой системы FAT32.

Разметка дисков GPT

Выберите один из следующих способов создания ESP для диска GPT с разделами:

  • fdisk/gdisk: Создайте раздел с типом раздела EFI System ( EFI System в fdisk или EF00 в gdisk). Перейдите к разделу #Форматирование раздела ниже.
  • GNU Parted: Создайте раздел FAT32 и в Parted установите/активируйте флаг boot (не флаг legacy_boot ) на этом разделе. Перейдите к разделу #Монтирование раздела ниже.

Разметка дисков MBR

Создайте раздел с типом раздела EFI System, используя fdisk. Перейдите к #Форматирование раздела.

Форматирование раздела

После создания ESP вы должны форматировать его как FAT32:

Если вы использовали GNU Parted выше, тогда раздел уже должен быть отформатирован.

Если вы получили сообщение WARNING: Not enough clusters for a 32 bit FAT! , уменьшите размер кластера с помощью команды mkfs.fat -s2 -F32 . или -s1 ; иначе раздел может быть нечитаемым UEFI.

Монтирование раздела

This article or section needs expansion.

В случае EFISTUB файлы ядра и initramfs должны храниться в системном разделе EFI. Для простоты вы также можете использовать ESP в качестве самого раздела /boot вместо отдельного раздела /boot для загрузки EFISTUB. Другими словами, после создания и форматирования системного раздела EFI, как указано выше, просто смонтируйте на /boot .

Известные вопросы

ESP на RAID

Можно сделать часть ESP массива RAID1, но при этом возникает риск повреждения данных, и при создании ESP необходимо учитывать дополнительные соображения. Для получения допольнительной информации смотрите [3] и [4].

Советы и хитрости

Использование bind монтирования

Вместо того, чтобы устанавливать ESP на /boot , вы можете подключить каталог ESP к /boot с помощью bind монтирования (смотрите mount(8) ). Это позволяет pacman обновлять ядро напрямую, сохраняя при этом организацию ESP по своему вкусу.

Как и в EFISTUB#Альтернативные точки монтирования для ESP [ссылка недействительна: раздел не найден] , скопируйте все загрузочные файлы в каталог вашего ESP, но смонтируйте ESP вне /boot (например, /esp ). Затем привяжите смонтированный раздел к каталогу:

После проверки успеха отредактируйте свой Fstab, чтобы изменения были постоянными:

Читайте также:  How to change language in firefox interface to english in windows

Источник

Как создать системный раздел EFI?

TL; DR Как создать системный раздел EFI с нуля? Как я могу поместить прошивку EFI на нее, она создана?

Длинная версия

Я hava Toshiba T430 ноутбук. Я получил его с установленной Windows 7 (но я думаю, что первоначально он поставляется с Windows 8). Я установил Ubuntu на него, но удалил некоторые разделы на диске, чтобы в итоге я уничтожил Windows и имел только Ubuntu. Среди удаленных разделов был раздел системы EFI. Я обнаружил, что Ubuntu теперь загружается в режиме Legacy (а не UEFI). Я пытаюсь выполнить это руководство по конвертации моей установки Ubuntu из Legacy в UEFI . Проблема — поскольку нет раздела EFI, когда я выбираю из BIOS для загрузки с использованием UEFI, я не могу загрузиться. Это важно не только для жесткого диска, но и для usb и DVD. Я думаю, что это логично — он ожидает раздел EFI и, поскольку он не может его найти, он не может продолжать загрузку дальше, будь то с HDD или DVD. Итак, как мне воссоздать раздел EFI?

В приведенном выше руководстве говорится:

Создание раздела EFI

Если вы вручную разбиваете диск на диск в установщике Ubuntu вам нужно убедиться, что у вас есть EFI настройка раздела.

Если ваш диск уже содержит раздел EFI (например, если ваш компьютер был предустановлен Windows8), он также может использоваться для Ubuntu. Не отформатируйте его. Настоятельно рекомендуется иметь только один раздел EFI на каждый диск.

Раздел EFI может быть создан с помощью последней версии GParted (версия Gparted, включенная в диск 12.04, в порядке), и она должна иметь следующие атрибуты:

Точка монтирования: /boot /efi (примечание: нет необходимости устанавливать эту точку монтирования, когда используя ручное разделение, установщик Ubuntu обнаружит его автоматически)

Размер: минимум 100Mib. Рекомендуется 200MiB.

Другое: требуется флаг загрузки.

У меня возникли проблемы с созданием этого раздела:

  • Я загружаюсь с живого DVD-диска Ubuntu, открываю GParted, создаю раздел 200 МБ и отформатируем его на FAT32.
  • В GParted я не могу установить точку монтирования и, следовательно, не могу установить bootflag.
  • Я не установил точку монтирования в /etc/fstab , так как это live CD и fstab выглядел совсем иначе, чем ожидалось по сравнению с обычная загрузка. Во всяком случае, я просто не знал, какие значения установить.

Я снова загрузился через живой DVD, а затем решил установить Ubuntu. Затем я создал раздел с указанными критериями — точкой монтирования, 200 МБ, FAT32, флагом загрузки.

Однако у меня все еще есть эта проблема, и я полагаю, что это потому, что на этом разделе нет прошивки EFI, это всего лишь пустой раздел, подходящий для прошивки EFI.

Итак, как мне создать раздел EFI с программным обеспечением EFI, чтобы ноутбук мог снова загрузиться в режиме UEFI?

РЕШЕНИЕ Благодарим вас обоих за ответы. То, что я сделал, это установить Windows 8.1 с нуля, форматируя весь диск, а затем установив (на этот раз правильно) Ubuntu рядом с ним. Это мои разделы:

Во время установки Win 8, как только я удалил все существующие разделы и Windows переформатировал диск, он автоматически создал, помимо основного раздела установки, три дополнительных раздела, а именно 1, 2, 3. Теперь, после того, как я правильный ESP, я мог бы загрузиться с HDD или DVD в режиме UEFI.

Вы говорите, что ESP не сохраняет информацию по умолчанию, но я предполагаю, что когда ОС устанавливается, она помещает некоторую информацию там. Поэтому я предполагаю, что мое дело было следующим: я уничтожил его, и хотя я его воссоздал, он не был заполнен информацией, поскольку создание ESP было выполнено после установки ОС. Я потерял установку Ubuntu (неважно, это была новая установка в любом случае), но я предполагаю, что для ее сохранения я должен был следовать %20%D0%B3%D1%80%D0%B0%D0%BC%D0%BE%D1%82%D0%BD%D0%BE%D1%81%D1%82%D1%8C%20.%20%D0%9E%D0%B4%D0%BD%D0%B0%D0%BA%D0%BE%20%D0%BD%D0%B5%20%D0%B1%D1%8B%D0%BB%D0%BE%20%D0%B2%D1%80%D0%B5%D0%BC%D0%B5%D0%BD%D0%B8,%20%D0%BD%D0%BE,%20%D0%BA%20%D1%81%D1%87%D0%B0%D1%81%D1%82%D1%8C%D1%8E,%20%D1%82%D0%B5%D0%BF%D0%B5%D1%80%D1%8C%20%D0%B2%D1%81%D0%B5%20%D0%B2%20%D0%BF%D0%BE%D1%80%D1%8F%D0%B4%D0%BA%D0%B5.%20

Источник

Оцените статью