Redhat 7 Boot Process
Redhat 7 Boot Process
Redhat 7 Boot Process
com/blog/step-by-step-red-hat-enterprise-
linux-7-booting-process/)
The following diagram shows the high level stages of a typical Linux boot
process:
POST function : - When you power on your system, it will read all
the devices settings and executes the POST (Power ON Self-Test) process to
recognize the Hardware devices to test and initialize the system Hardware
components. After successful POST process, it will load the MBR (Master
or
When we power on the system , the Power-On Self-Test (POST) is executed, and the
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. You can
press a key (typically F12 of F2, but it depends on your system) during
the BIOS startup to change the boot sequence.
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 bootloader program used on RHEL 7 is GRUB 2. GRUB
stands for Grand Unified Bootloader. GRUB 2 replaces the older GRUB
bootloader 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:
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: systemctl halt and halt are also available to stop the system, but
unlike their poweroff equivalents, these commands do not power off the
system; they bring a system down to a point where it is safe to manually power
it off.
Managing GRUB
Here is how you would run this utility to reproduce the grub.cfg file on BIOS and
UEFI systems, respectively:
The grub.cfg file contains menuentry blocks for each installed kernel. Each
block begins with a title and includes the names of the kernel and RAM disk
image files, their location with respect to /boot, and several options and
modules to be loaded. These menu entry titles are displayed at the time of
system boot and you can choose one of them to boot.
If a new kernel is added to the system, existing kernel entries will remain in this
file and can be chosen in the GRUB menu at startup to boot.
Important Directives:
Isolating a target will stop services not required by that target and start any
required services that have not yet been started.
Instead of editing this symbolic link by hand, the systemctl tool comes with two
commands to manage this link: get-default and set-default as shown below: