/boot , /boot/grub , /boot/efi

The directories /boot, /boot/grub, and /boot/efi are crucial for the boot process of a Linux system. They contain the necessary files and configurations to start the operating system. Here’s a detailed look at their contents and their roles:

/boot Directory

The /boot directory contains the kernel and bootloader files necessary for booting the Linux operating system. Here are some common files and their purposes:

  • vmlinuz: The compressed Linux kernel.

  • initrd.img or initramfs.img: The initial RAM filesystem image used during the boot process to prepare the system before the actual root filesystem is mounted.

  • System.map: A symbol table used by the kernel.

  • config-<kernel_version>: The configuration file used to build the kernel.

Example Listing:

$ ls /boot
config-5.4.0-42-generic
grub
initrd.img-5.4.0-42-generic
vmlinuz-5.4.0-42-generic
System.map-5.4.0-42-generic

/boot/grub Directory

The /boot/grub directory contains the configuration files and modules for the GRUB (GRand Unified Bootloader). GRUB is a popular bootloader used to manage multiple operating systems on a computer.

Common Files:

  • grub.cfg: The main configuration file for GRUB.

  • menu.lst or grub.conf: Legacy configuration files used in older GRUB versions.

  • grubenv: A file used to store environment variables for GRUB.

  • i386-pc/ or x86_64-efi/: Directories containing GRUB modules for various architectures.

Example Listing:

$ ls /boot/grub
fonts
grub.cfg
grubenv
i386-pc
locale
unicode.pf2
  • grub.cfg: This is the main configuration file that defines the boot menu and options.

    $ cat /boot/grub/grub.cfg

    It contains menu entries for different kernels and operating systems.

/boot/efi Directory

The /boot/efi directory is used in systems with UEFI (Unified Extensible Firmware Interface) instead of the traditional BIOS. It contains the EFI System Partition (ESP), which stores bootloaders, drivers, and system applications needed for booting the operating system.

Common Files and Directories:

  • EFI/: The main directory containing subdirectories for different operating systems and their bootloaders.

  • BOOT/: The directory containing the default bootloader.

  • /: Directories specific to each installed operating system or hardware vendor.

Example Listing:

$ ls /boot/efi
EFI

Inside the EFI directory, you might find:

$ ls /boot/efi/EFI
BOOT
ubuntu
Microsoft
  • EFI/BOOT: Contains the fallback bootloader, usually named BOOTX64.EFI.

  • EFI/ubuntu: Contains the GRUB bootloader files for Ubuntu.

Example Usage:

  • Updating GRUB Configuration: After installing a new kernel, you often need to update the GRUB configuration:

    sudo update-grub
  • Installing GRUB to a Disk:

    sudo grub-install /dev/sda

Conclusion

The /boot, /boot/grub, and /boot/efi directories are essential for managing the boot process on Linux systems. They contain the necessary kernels, initial RAM filesystems, and bootloader configurations required to start the operating system. Understanding their contents and structure is crucial for system administration and troubleshooting boot-related issues.

Last updated