Will see the Booting process in RHEL7/ CentOS 7 in this post. It’s very important to know the booting process for all operating system. It will help us to troubleshoot the booting issues.
We are going to see about RHEL / Cent OS 7 booting process.
Below are booting stages:
BIOS stands for basic input output system.
It will do a POST (Power on self-test) to check system hardware.
And it will search, load and execute MBR in memory(Master Boot Recorder).
MBR Stands for Master boot recorder.
MBR will be available in first 512 bytes of the boot drive. In this 512 bytes 446 bytes contains boot loader information, in 64 bytes contains partition table information available and remaining 2 bytes for MBR validation check. Boot drive will be anything like Hard disk, Pendrive, Floppy.
MBR will search and load the GRUB2 boot loader in memory and control moved to the bootloader.
GRUB stands for Grand Unified Bootloader.
GRUB will be the default boot loader in RHEL7.
GRUB configuration file is available in this path: /boot/grub2/grub.cfg. Editing this file directly is not advisable.
GRUB file configuration:
# cat /etc/default/grub GRUB_TIMEOUT=5 GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="rd.lvm.lv=rhel/swap crashkernel=auto rd.lvm.lv=rhel/root rhgb quiet net.ifnames=0" GRUB_DISABLE_RECOVERY="true"
To change these configuration settings will edit this /etc/default/grub file.
Once modified have to execute the below command to make this change affect in the main configuration file (/boot/grub2/grub.cfg).
# grub2-mkconfig –o /boot/grub2/grub.cfg
grub has kernel image(vmlinuz) and initramfs image details.
grub will search and load the kernel image into memory and it will extract the initramfs image contents into memory based filesystem which is called tmpfs.
initramfs stands for initial ramdisk
initial ramdisk will load the block devices (HDD, CD, Floppy, etc). So that it will find the exact root filesystem and will mount it. Till mounting this exact root filesystem, initramfs will act as a temporary root filesystem.
kernel mounts the initramfs image as two-stage boot process.
Will use the lsinitrd command to view initramfs content.
Kernel will start systemd process and PID is 1 for this, as this will be the first process.
root 1 0 0 02:10 ? 00:00:02 /usr/lib/systemd/systemd --switched-root --system --deserialize 23
Systemd will be the first process.
This process will read the /etc/systemd/system/default.target file to determine the default system target. The system target file defines the services which is started by systemd.
Systemd will bring the system based on the system target runlevel and perform system initialization process such as hostname, network settings, initializing SELinux, Printing welcome banner and mounting all filesystems.