Linux Boot Process
The below image outlines the typical flow of a Linux system boot.
1. BIOS (Basic Input/Output System) / UEFI (Unified Extensible Firmware Interface)
When the system powers on, BIOS (Basicor Input/OutputUEFI System)is the first code that runs. BIOS/UEFI are responsible for checking and UEFIinitialising (Unifiedthe Extensibledetected Firmwarehardware, Interface)and are both firmware interfaces that provideidentifying a criticaldisk layerto betweenboot yourfrom hardware(can andbe operatingchanged systemvia duringboot the startup process. However, they differ significantly in their functionality and capabilities.order)
Similarities:Key Functions:
BothPerforms POST (Power-On Self Test) to check hardware
-
Initializes hardware components (CPU, RAM, disks, etc.)
-
Finds a bootable device based on boot order
-
Loads the bootloader (like GRUB2) from:
-
The MBR on BIOS
andsystems -
The EFI System Partition (ESP) on UEFI
aresystemspre-installed on your motherboard and activate when you turn on your computer. They perform essential tasks like initializing hardware components, performing power-on self-tests (POST), and loading the operating system from a storage device.
-
MBR - Master Boot Record / GPT - GUID Partition Table
Once the bootloader is found, BIOS/UEFI hands control over to it to continue the boot process.
MBR (Master Boot Record)
MBR GPTis (GUID Partition Table) are both partition table formats used on harda disk drivesconfiguration (HDDs)where anda solid-statesmall drives (SSDs) to define how the storage space is organized. However, they have some key differences:
Similarities:
Both MBR and GPT are locatedsection at the beginning of astoragediskdevice(first 512 bytes) is used for storing bootloader code anddefine howthestoragepartitionspace is divided into partitions.They both store information about each partition, such as its size, file system type, and location on the disk.Both allow you to create multiple partitions on a single storage device, enabling you to manage different operating systems or data types more efficiently.Identification of boot loader (typically at beginning of disk) - Once identified, the boot process is handled by the boot loader - most commonly GRUB2.
Note;table. MBR is antypically olderonly standardused ofon partitioning,BIOS mostsystems.
ESP will(EFI nowSystem usePartition)
ESP is a FAT-32 formatted partition on GPT disks that is used for storing bootloader files and other boot files. During boot, UEFI reads from this partition to boot the OS.
2. GRUB2 (Grand Unified Boot Loader)
GRUB2 is a software program, specifically a bootloader. Its primary function is to take control during the computer startup process after the firmware (BIOS or UEFI) has initialized the hardware. Here's a breakdown of its role:
LoadingGRUB2 will present theOperating'bootSystemmenu'Kernel:GRUB2 locatesto thekerneluser(the-corethisprogram)canofbeyourusedoperatingforsystemchangingonOS, entering rescue mode, etc.- GRUB2 finds the
storage device. It then loads thislinux kernelintoimagememory.and initramfs/initrd startsGRUB2 configures kerneland systemd.parameteres
Initrd3. Kernel & Kernelinitramfs/initrd
Once GRUB2 has loaded the kernel and initramfs/initrd into memory, the kernel then continues the boot process.
What is initrd?
-
initrd (
initialisationinitial RAM disk) isessentiallyasettemporaryoffilesysteminstructionsloadedusedinto memory during the early boot stage. -
It contains essential drivers and scripts needed to
loadinitialize hardware and mount thekernel.real root filesystem. -
It helps the kernel boot successfully when the root filesystem requires special drivers (e.g., RAID, LVM, encryption).
-
Once the real root filesystem is mounted, the initrd is
stored temporarily in system memory whilst the kernel is loaded.discarded.
What is a Linux Kernel?
-
The Linux kernel is the core
softwarecomponentthat acts as an interface betweenof thehardware and various software applications running on youroperating system. -
It manages hardware resources, handles system calls, and provides essential services for all other software.
-
The kernel is responsible for managing CPU, memory, device drivers, and system security.
4. Systemd
Systemd is the first process that starts on a booting OS. Systemd is a foundational software suite for Linux operating systems. It acts as a system and service manager, handling tasks like booting up the system and managing services that run in the background.
