Linux Boot Process in RHEL7/RHEL6.

In this article we will cover boot process of RHEL/CentOs 6/7.

What is Booting or Boot process ?

– Booting is a bootstrapping process that starts operating systems when the user turns on a computer system.

– Bootstrapping usually refers to a self-starting process that is supposed to proceed without external input.

– A boot sequence is the set of operations the computer performs when it is switched on that load an operating system.

Booting Process in RHEL/CENTOS7


Booting sequence contains various stages which we will learn step by step.

1. BIOS.

BIOS (Basic Input/Output System) refers to the software code run by a computer when first Powered On.

The primary function of BIOS is code program embedded on a chip that recognizes and controls various devices that make up the computer.

– Basically bios keep the information of bootable disk it retrieves this information from CMOS (complementry metal oxide semiconductor), CMOS is battery operated memory chip on the

motherboard, it stores lots of information like data,time,critical info etc. It also stores the hardware configuration permanently.

– We can also set the priority like cdrive, network boot. so bios tells the from which disk it needs to boot.

– After reading first sector of the physical bootable disk, usually it contain in the first 512bytes of the bootable disk and this 512 bytes called the MBR.


2. MBR (Master Boot Record):

  • OS gets boot from a hard disk, Where the Master Boot Record (MBR) contains the primary boot loader.
  • The MBR is a 512-byte in size, located in the first sector on the disk (sector 1 of cylinder 0, head 0)
  • After the MBR is loaded into RAM, the BIOS yields control to it.
  • 446 bytes from MBR contain the information of the secondary boot loader i.e /boot.
  • The first 446 bytes are the primary boot loader, which contains both executable code and error message text.
  • The next sixty-four bytes are the partition table, which contains a record for each of four partitions.
  • The MBR ends with two bytes that are defined as the magic number (0xAA55). The magic number serves as a validation check of the MBR

3. GRUB2:

Secondary bootloader is your grub and it is independent of OS, it means when you boot your system you can interrupt your system at grub level.

  • The main function of the boot loader is to load kernel into the memory, So the grub will tell which kernel needs to boot.
  • The default bootloader program used in 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.
  • If changes are made to any of these parameters, you need to run grub2-mkconfig to re-generate the /boot/grub2/grub.cfg
# grub2--mkconfig -o /boot/grub2/grub.cfg
  • GRUB2 searches the compressed kernel image file also called as vmlinuz in /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.
  • Stage 1 boot-loader is an MBR and it contains the sector information of stage 2 which is in your /grub and stage 2 bootloader provides the boot menu to the user based grub.conf.
  • GRUB Stage 1.5 is located in the first 30 kilobytes of hard disk immediately following the MBR. Stage 1.5 loads Stage 2.
  • 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:
# lsinitrd | less

So, in simple terms GRUB2 just loads and executes Kernel and initramfs images.

4. Kernel:

  • The kernel is the central part in most computer operating systems because of its task, which is the management of the system’s resources and the communication between hardware and software components
  • Kernel is always store on memory until computer is turned off.
  • Kernel image is not an executable kernel, but a compress kernel image

– Linux Kernel is the 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 Drivers from initrd.img to load system first process systemd in Linux 7.

5. systemd:

  • systemd process is the first process ID (PID 1) to run on Linux 7 systems, it initializes the system and launches
  • It controls the final stages of booting and prepares the system for use. It also speeds up booting by loading services concurrently.
  • systemd reads the file linked by /etc/systemd/system/ to determine the default system target . The system target file defines the services that systemd starts.

To View the current target unit.

[[email protected] ~]# systemctl get-default
[[email protected] ~]#

You can change the default target level by using below commands.

# [[email protected] ~]# systemctl set-default

Booting Process in RHEL/CENTOS 6:

1. 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.

2. 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:
  • Primary boot loader info in 1st 446 bytes
  • Partition table info in next 64 bytes
  • MBR validation check in last 2 bytes.
  • It contains information about GRUB or LILO in old systems.

So, in simple terms MBR loads and executes the GRUB boot loader.

To see the contents of MBR use below command:

# dd if=/dev/hda of=mbr.bin bs=512 count=1

# od -xa mbr.bin

Where, od command to print the binary file in hex and ASCII formats.

– Secondary bootloader is your grub and it is independent of OS, it means when you boot your system you can interrupt your system at grub level.

3. GRUB:


  • GRUB stands for Grand Unified Bootloader.
  • If you have multiple kernel images installed on your system, you can choose which one to be executed.
  • GRUB displays a splash screen, waits for few seconds, if you don’t enter anything, it loads the default kernel image as specified in the grub configuration file.
  • Grub configuration file is /boot/grub/grub.conf
  • So, in simple terms GRUB just loads and executes Kernel and initrd images.


4. Kernel:

  • Kernle is the central part of OS, and prior to kernel, initramfs (initial ram disk) which is mounted to the real root file system. It loads temporary root file system into memory.


  •  Is detects what all device drivers are needed to load the actual file system and it loads them from a temporary file system. After that, other partition like LVM, RAID etc is mounted then initrd is unmounted.
  • The first thing the kernel does is to execute init program.
  • Init is the root/parent of all processes executing in Linux.

5. Init process:

  • init is the first process in rhel/centos 6 system.
  • The first processes that init starts is a script /etc/rc.d/rc.sysinit.
  • Based on the appropriate run-level, scripts are executed to start various processes to run the system and make it functional.
  • The init process is identified by process id “1“
  • Init is responsible for starting system processes as defined in the /etc/inittab file
  • Upon shutdown, init controls the sequence and processes for shutdown.
# ps -ef | grep init

Inittab file:

– The inittab file describes which processes are started at boot up and during normal operation


– The computer will be booted to the runlevel as defined by the initdefault directive in the /etc/inittab file


6. Runlevel:

Following are the available run levels

  • 0 – halt
  • 1 – Single user mode
  • 2 – Multiuser, without NFS
  • 3 – Full multiuser mode
  • 4 – unused
  • 5 – X11
  • 6 – reboot

Depending on your default init level setting, the system will execute the programs from one of the following directories.

  • Run level 0 – /etc/rc.d/rc0.d/
  • Run level 1 – /etc/rc.d/rc1.d/
  • Run level 2 – /etc/rc.d/rc2.d/
  • Run level 3 – /etc/rc.d/rc3.d/
  • Run level 4 – /etc/rc.d/rc4.d/
  • Run level 5 – /etc/rc.d/rc5.d/
  • Run level 6 – /etc/rc.d/rc6.d/

In /etc/rc.d/rc*.d/ directory you can see programs starting with S and K, Program starting with S is used during startup and Program starting with K is used during shutdown.


That’s it in this article, Please share and subscribe for upcoming tutorials.



    Leave a Reply

    Your email address will not be published. Required fields are marked *