Linux 101 : The boot process, MBR-GPT, BIOS-UEFI, intird, ...

The Basic Input-Output System -BIOS -is a small program that is stored on a the motherboard's chip. 

The BIOS program checks the hardware and launches the boot loader - GRUB, LILO - deprecated -, Syslinux, ... -.

The BIOS comes with an interface that we could access just as the system boots by hitting one of the function keys - depending on the machine -, to make changes to our hardware settings.

UEFI Unified Extensible Firmware Interface - is the "new upgraded" BIOS

UEFI can handle larger memory sizes and can manage larger hard drives than the BIOS, it also comes with added security features.

The BIOS and the UEFI are the major ways used to boot a system. But we could use other ways to do so as described below.

PXE - Preboot Execution Environment - allows a machine to get the bootloader and other system files from a remote server and boot a system using them.
The files are transferred using an FTP server. Usually the DHCP, the PXE server and the FTP server run on the same remote machine. 
Booting from NFS over the network is another boot option. The 
root filesystem "lives" on a remote NFS share.
The "booting" client will mount the remote NFS share locally and use it as its root file system.

Some definitions:

The MBR boot sector - first sector on a drive -:
  • Holds the code for  the boot loader that loads the operating system into the RAM.
  • Holds the partition table of the hard drive - contains information about the bootable partition, free space, ... -. 
  • Can't be used with drives larger than two terabytes.
  • Drives partitioned using the MBR scheme are limited to four primary partitions.
GPT GUID Partition Table - is the "replacement" of the old MBR.

Each GPT partition gets a globally unique identifier - GUID -.
GPT can accommodate very large drives.
If there is any limitation regarding the drive size, it would most likely come from the filesystem used with it. 
As opposed to MBR, GPT spreads the boot information over different parts of the hard drive to decrease the risk of data corruption and also to be able to recover from boot errors using copies of the boot information.

Beside the MBR and the GPT formatting scheme, we also also have a RAW formatting scheme.

A raw partition is a block device that allows us to interact with it at the lowest level, directly bypassing the system cache. 
It could be used with applications that have their own caching system like certain types of database.
A raw partition could be created using the below command:

  • bs : Block size.
  • if : input files - consisting of zeros -
  • of : output file - the partition to write "zeros" to -

The initial ramdisk is the temporary root filesystem that is loaded into the RAM during the boot process.

The initrd allows a minimal system to boot, to be able to load the "full" filesystem after.
Upon loading the "full" filesystem the initrd file system is deleted and the boot process continues with the systemd is user space.

Initrd allows the kernel to be lighter - contains less modules and less code - since it delegates the initial tasks - loading drivers, root filesystem, ... - to the temporary initrd root filesystem.

The Linux initrd come in an image format - .img - that has all the files necessary for booting a system, it is stored in the "/boot" directory.

Initrd is very flexible since we could add to it, or remove from it different modules to handle different hardware, ..., using the mkinitrd command.

We use the mkinitrd command to create an initrd image with different kernel modules. 
The below command creates an initrd image from the kernel we are using:

The command "uname -r" gives us the currently used kernel.


The initramfs filesystem is the "new" initrd.


  • The BIOS-UEFI looks for a bootable storage device.
  • The BIOS-UEFI loads the boot loader from the MBR-GPT partition into the RAM.
  • The  boot loader GRUB 2 displays a message on the screen so that we could pick a system to boot with.
  • The boot loader loads the initrd image into the RAM and hands over the control to the kernel. 
  • The kernel finds the initrd image and mounts it to be able to load the  driver modules.
  • The kernel then mounts the "full" root partition and removes the temporary initrd root filesystem for memory.
  • The systemd program takes over as the first process in the user space - ID=1 -.
  • The systemd moves to the "" target - and starts all the services associated with the -, which could be the or the  It also mounts the file system - after consulting "/etc/fstab" -. 

are the equivalent of runlevels of the System-V init.


Leave as a comment: