Home » glossary » Linux Booting Sequense

Linux Booting Sequense

The Linux startup process is the process of Linux/Unix operating system. In this tutorial you will know about boot process of linux operating system. When you press power button of your system and after few time you see the login prompt. This tutorial will help you to understand Linux Booting Sequense.
1.BIOS support for Basic Input/Output System
Performs some system integrity verification
Detection, loads, and executes the boot loader program.
It search boot loader in floppy, cd-rom, and hard drive. You can press a key (generally DELETE, F2, KEY but depends on your system) during the BIOS startup to change the boot order.
Once the boot loader is detected and loaded into the memory, BIOS provides the control to it.
So, in short BIOS loads and executes the MBR boot loader.
2. MBR
MBR stands for Master Boot Record.
It is situated in the 1st sector of the bootable disk. Normally /dev/hda, or /dev/sda
MBR is less than 512 bytes in size and has three components
1) primary boot loader information in 1st 446 bytes
2) partition table contents in next 64 bytes
3) mbr validation verification in previous 2 bytes.
It contains information about GRUB (or LILO in old systems).
So, in simple terms MBR loads and runs the GRUB boot loader.

3. GRUB
GRUB:- Grand Unified Bootloader.
If multiple kernel images installed on your system, you have choice to select which one to be executed.
GRUB shows a splash screen, waits for 5 seconds, if you don’t enter anything, it loads the default kernel image as specified in the grub configuration file.
GRUB has the knowledge of the filesystem (the older Linux loader LILO didn’t understand filesystem).
Grub configuration file is /boot/grub/grub.conf (/etc/grub.conf is a bond to this). The below sample grub.conf of CentOS.
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-34x.4.1.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-34x.4.1.el5 ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.18-34x.4.1.el5.img
So, in simple terms GRUB just loads and runs Kernel and initrd images.

4. Kernel
Mounts the root file system as specified in the “root=” in grub.conf
Kernel executes the /sbin/init program
Since init was the 1st program to be executed by Linux Kernel, it has the process id (PID) of 1. Do a ‘ps -ef | grep init’ and check the pid.
initrd stands for Initial RAM Disk.
initrd is use by kernel as temporary root file-system until kernel is booted and the real root file-system is mounted
5. Init

Looks at the /etc/inittab file to decide the Linux run level.
The existing run levels are below
0 – halt
1 – Single user mode
2 – Multiuser, without NFS
3 – Full multiuser mode
4 – unused
5 – X11
6 – reboot
Init identifies the default init run level from /etc/inittab and uses to load all appropriate level.
Execute ‘grep initdefault /etc/inittab’ on your system to identify the default run level
6. Runlevel programs

When the Linux system is booting up, you will see various services getting started.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/
You can easily understand the linux booting process through below image.
boot-process

About

I am founder and webmaster of www.linuxpcfix.com and working as a Sr. Linux Administrator (Expertise on Linux/Unix & Cloud Server) and have been in the industry from last 7 years.

Leave a Reply

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

*
*

Time limit is exhausted. Please reload the CAPTCHA.

Categorized Tag Cloud