Thursday, April 23, 2015

Linux Boot Process

In this article we are going to study “Linux Boot Process”. During booting time of Linux operating system, boot process have to go through six basic stages.
Boot Stage 1:
BIOS Checks: When a Linux server or desktop or laptop booted, The processor goes for Basic Input/Output System or BIOS program and runs it.The BIOS controls does not controll only the first step of the boot process, but BIOS also provides the lowest level interface to peripheral devices. It means during the BIOS initialization, all hardware peripheral devices checked out by BIOS. If BIOS found any hardware is faulty, you will get message on your screen.For this reason BIOS Process is written into read-only mode.The BIOS then loads into memory whatever program is residing in the first sector of this device, called the Master Boot Record or MBR. The MBR is only 512 bytes in size and contains machine code instructions for booting the machine, called a boot loader, along with the partition table. Once the BIOS finds and loads the boot loader program into memory,it yields control of the boot process to it.

Note: The default boot loader for Linux platform is GRUB.
Boot Stage 2:
First stage boot loader: The first stage of Boot Loader is a small machine code binary on MBR. The first stage boot loader loads itself into memory.first stage boot loader job is to find out the second stage boot loader and load the first part of it into memory.
Boot Stage 3:
Second stage boot loader: The second stage boot loader loads the kernel into memory, which in turn loads any necessary modules and mounts the root partition read-only. Once the second stage boot loader is in memory, it presents the user with a graphical screen showing the different operating systems or kernels that has been configured to boot. You can use Arrow keys to select your operating system for boot.

Boot Stage 4:
INIT Program: The Linux operating system kernel transfers the control of the boot process to the /sbin/init program.The /sbin/init program  coordinates the rest of the boot process and configures the environment for the user.
Boot Stage 5:
User Environment Setup: The init program loads all services and user-space tools, and mounts all partitions listed in /etc/fstab. When the init command starts, it becomes the parent or grandparent of all of the processes that start up automatically on the system. First, it runs the /etc/rc.d/rc.sysinit script, which sets the environment path, starts swap, checks the file systems, and executes all other steps required for system initialization.The init command then runs the /etc/inittab script, which describes how the system should be set up in each SysV init runlevel.The init program starts all of the background processes by looking in the appropriate rc directory for the runlevel specified as the default in /etc/inittab. The rc directories are numbered to correspond to the runlevel they represent.

Note: By Default, run level 5 is defined in /ete/inittab file.
Boot Stage 6:
Login Screen: The user will get a login screen for the freshly booted Linux system.
Interview Questions for Linux Boot Process chapter

Q1: How many stages a Linux boot process passes during booting time?
Q2: What is First boot loader stage?
Q3: What is Second boot loader stage?
Q4: What is the role of INIT program for RED HAT LINUX?
Q5: Explain RUN LEVELS for Linux Operating systems.
Q6: Difference between inittab and fstab file?
Q7: What does BIOS do during booting?
This article is posted by Parveen Kumar (

No comments:

Post a Comment