Red Hat Enterprise Linux 7 Booting Process
Red Hat Enterprise Linux 7 Booting Process
Red Hat Enterprise Linux 7 Booting Process
RHEL goes through the boot process when the system is powered up or reset, with the boot
process lasting until all enabled services are started and a login prompt appears on the
screen.
The following diagram shows the high level stages of a typical Linux boot process:
BIOS
BIOS stands for Basic Input/output System
Performs some system integrity checks
Searches, loads, and executes the boot loader program.
It looks for boot loader in floppy, CD-ROMs, or hard drive. Once the boot loader
program is detected and loaded into the memory, BIOS gives the control to it.
So, in simple terms BIOS loads and executes the MBR boot loader.
MBR
MBR stands for Master Boot Record.
It is located in the 1st sector of the bootable disk. Typically /dev/hda, or /dev/sda
MBR is less than 512 bytes in size. This has three components as shown:
o Primary boot loader info in 1st 446 bytes
o Partition table info in next 64 bytes
o MBR validation check in last 2 bytes.
It contains information about GRUB2 (GRUB or LILO in old systems).
So, in simple terms MBR loads and executes the GRUB2 boot loader.
GRUB2
The default boot loader program used on RHEL 7 is GRUB 2. GRUB stands for
Grand Unified Boot loader. GRUB 2 replaces the older GRUB boot loader also called
as legacy GRUB.
The GRUB 2 configuration file is located at /boot/grub2/grub.cfg (Do not edit
this file directly).
GRUB 2 menu-configuration settings are taken from /etc/default/grub when
generating grub.cfg.
Sample /etc/default/grub file:
GRUB2 searches the compressed kernel image file also called as vmlinuz in
the /boot
GRUB2 loads the vmlinuz kernel image file into memory and extracts the contents
of the initramfs image file into a temporary, memory-based file system (tmpfs).
The initial RAM disk (initrd) is an initial root file system that is mounted before the
real root file system.
The job of the initial RAM file system is to preload the block device modules, such
as for IDE, SCSI, or RAID, so that the root file system, on which those modules
normally reside, can then be accessed and mounted.
The initramfs is bound to the kernel and the kernel mounts this initramfs as part of
a two-stage boot process.
The Dracut utility creates initramfs whenever a new kernel is installed.
Use the lsinitrd command to view the contents of the image created by dracut:
So, in simple terms GRUB2 just loads and executes Kernel and initramfs
images.
Kernel
Linux Kernel is the central core of the OS and it is the first program loaded on the
system starts up. While system starting kernel loads all the necessary Kernel
Modules and Drives from initrd.img to load system first process systemd in Linux
7.
The kernel starts the systemd process with a process ID of 1 (PID 1) as shown
below:
systemd
Systemd process is the first process ID (PID 1) to run on Linux 7 systems, it
initializes the system and launches all the services that were once started by the
traditional init (/etc/init.d) process. Systemd process reads the configuration file
of /etc/systemd/system/default.target, then its load the OS in
targeted target.
This tells systemd to start everything in the /usr/lib/systemd/system/basic. target
before starting the other multi-user services.
systemd brings the system to the state defined by the system target, performing
system initialization tasks such as:
Setting the host name
Initializing the network
Initializing SELinux based on its configuration
Printing a welcome banner
Initializing the system hardware based on kernel boot arguments
Mounting the file systems, including virtual file systems such as the /proc file
system
Cleaning up directories in /var
Starting swapping
Systemd uses ‘targets’ instead of runlevels. By default, there are two main targets:
o multi-user.target: analogous to runlevel 3
o target: analogous to runlevel 5
Note: Refer Man pages for more details: info grub2