EFI System

June 20, 2015, 6 p.m.

Generally, an EFI is an interface between the hardware and its firmware and the loader of the operating system. Practically, what a user interested in dual booting or multi booting Windows 8/8.1 and Linux needs to know are that an EFI system can only be used with a GPT disk and the following.

EFI or UEFI Firmware

The EFI system has two components:

  • the part of the firmware that is aware of firmware devices of which the GRUB EFI bootloader is one, as well as other devices capable of booting the computer, such as internal and USB disks, optical drives -- these are listed in the EFI boot options menu
  • and
  • the fat formatted partition with the appropriate GPT partition type attribute set, where the OS loader is written

All of the most popular distributions support EFI systems; I have used openSuSE (one of the first to support EFI), Ubuntu based distributions, Sabayon, and NixOS, and the first three can be reliably used on an EFI system without problems. NixOS can also be used on and EFI system, but because it uses gummiboot instead of GRUB2, its boot loader can only boot NixOS and Windows and GRUB can't load any of the other Linuxs without difficult modification. So, for example, if one of the installed GRUBs is the default boot loader -- meaning it is at the top of the firmware boot loaders list in the UEFI settings, the UEFI settings have to be used to change the default boot loader to NixOS's firmware loader to boot to NixOS and vice versa. The only distribution that can't be used to reliably dual boot or multi boot is Fedora, although it can be reliably used as an EFI system on a single boot system.

Firmware Devices

The EFI firmware is aware of all of the hardware on a computer that is capable of booting an operating system, including hard drives, optical drives USB flash drives, and USB hard drives. All of these devices are listed and selectable in the UEFI settings, depending on the version of EFI and the implementation by the system manufacturer.

The firmware is also aware of firmware boot loaders such as Windows Boot Manager and GRUB which are written to the EFI firmware when an EFI compliant OS is installed. These firmware boot loaders are also selectable from the (U)EFI settings.

EFI System Partition

When an operating system is installed, in addition to writing the firmware device to the EFI firmware, the firmware boot loaders are written to the EFI System partition. The following figure modified from Microsoft Technet shows its default location, labeled System, on a hard drive with Windows installed.

EFI Partition on Disk
This diagram was modified from one found on Microsoft Technet.

This partition, on a computer with Windows 8/8.1 installed will have a directory named EFI which in turn has a directory named Microsoft, which itself has a directory named Boot. This directory has many files and directories, including localization files, ancillary files and directories, and the most important files,

  • bootmgfw.efi
  • bootmgr.efi
  • BCD

There are also secondary files associated with the BCD store and a memory test boot loader.

Most EFI capable Linux operating systems require that the EFI System partition be mounted to /boot/efi, (allowing a user with administrator rights to access to the EFI System partition).

Mounting the EFI System to /boot/efi during the installation of Sabayon.
In this case the EFI partition is /dev/sda2.

The distributions will write their firmware boot loaders (GRUB2 or GRUB2-EFI) to the EFI System partition in the EFI directory alongside the Microsoft directory -- if it already exists, in a directory named for the distribution. Most well behaved Linux distributions will not touch any existing files in the EFI directory. An exception I have found is Korora 20 (Fedora 20), which will delete everything in the EFI directory except its own files after reboot or after a kernel update. Also, note that all Ubuntu based distributions use the directory name ubuntu, making it difficult to install more than one distribution based on Ubuntu.

This figure shows the contents of the EFI directory, /boot/efi/EFI,

Contents of /boot/efi/EFI on a multi booting computer.
Voyager (Ubuntu based), Sabayon, NixOS, and Microsoft bootloaders coexist nicely on this computer..

on a multi boot EFI System partition.

As you may have noticed in the above figure, Linux distributions that support EFI but don't use GRUB as the bootloader -- such as NixOS, also use the EFI System partition but don't use the heirarchy of distributions that use GRUB2. NixOS wrote a directory in /boot/efi/EFI alongside Sabayon and Voyager (Ubuntu), but also installed gummiboot and a generic boot loader Boot/BOOXT64.EFI. It also wrote a directory called loader in the top level of the EFI System partition.

BCD Store

The BCD store is a database that contains configuration of the Windows Boot Manager, setting such things as the partition that contains the Windows OS, the partition that contains the Windows Recovery Environment partition, the partition to resume to when waking from sleep or hibernation. It will also show entries for each of the firmware devices that the EFI firmware is aware of such as disk drives, USB drives, optical drives, and more importantly for dual or multi booters, the part of the GRUB2 or gummiboot boot loaders that are installed to the EFI firmware.

It can also set things, at least in an earlier implementation of UEFI, like my Lenovo V570, the time before starting any boot loader, allowing the pressing of Function keys to access UEFI firmare settings and selection of one time boot device. The BCD store can also be edited to include in the Windows Boot Manager, other operating systems. (How to do this will be added to this website in the near future)

Conclusion

Again, an EFI or UEFI capable system offers many benefits to a user that wishes to dual boot or multi boot Linux. In addition to the benefits to even a single boot system, for the multi booter, there are the benefits of easy installation of multiple operating systems on virtually unlimited number of primary partitions and the installation of multiple boot loaders that each can load any of the installed operating systems (this is true of GRUB2 and Windows Boot Manager, but not necessarily true of gummiboot).