Linux Boot Sequence

Linux Boot Sequence

The process of booting a Linux system consists of a number of stages as follows


2) Master Boot Record (MBR)


4) Kernel

5) init

6) Run Levels

The process of booting a Linux system consists of a number of stages

1) BIOS:

Basic Input/Output System is the lowest level interface between the computer and peripherals which load boot sector from one of following devices

  • Floppy
  • Hard drive

The boot order can be changed from within the BIOS. BIOS setup can be entered by pressing a del ,F1 , F2, or F10 key during bootup.

2) MBR:

The first sector of the hard disk is reserved master boot record (MBR).

When we the Operating booting from a hard disk, the PC system BIOS loads and executes the boot loader code in the MBR. Here MBR needs to know which partitions on the disk have boot loader code specific to their operating systems in their boot sectors and then attempts to boot one of them.

Fedora Linux is supplied with the GRUB boot loader which is fairly sophisticated and therefore cannot entirely fit in the 512 bytes of the MBR.

The GRUB MBR boot loader merely searches for a special boot partition and loads a second stage boot loader.

This then reads the data in the /boot/grub/grub.conf configuration file, which lists all the available operating systems and their booting parameters. When this is complete, the second stage boot loader then displays the familiar Fedora branded splash screen that lists all the configured operating system kernels for your choice.

3) Boot loader (GRUB or LILO)

Lilo and Grub are installed or at the MBR (Master Boot Record), or at the first sector of the active partition.

Boot loader will ask for the OS label which will identify which kernel to run and where it is located (hard drive and partition specified). The installation process requires to creation/identification of partitions and where to install the OS. GRUB/LILO are also configured during this process. The boot loader then loads the Linux operating system.

LILO: (Linux Loader)

In case of a multi-boot config, LiLo permits the user two choose an operating system from the menu. The LiLo settings are stored at /etc/lilo.conf

  • LILO does not understand filesystems
  • Code and kernel image to be loaded is stored as raw disk offsets
  • Uses the BIOS routines to load

Grub (GNU Grub Unified Boot Loader)

  • Understands file systems
  • config lives in /boot/grub/menu.lst or /boot/boot/menu.lst

4) Kernel

-The kernel verifies hardware configuration and initialise devices. (optionally loads initrd, )

-The kernel tries to mount the file system and the system filesmounts root filesystem specified by lilo or loadin with root= parameter

The file system type is automatically detected. The most used file systems on Linux are ext2 and ext3. If the mount fails, a so-called kernel panic will occur, and the system will “freeze”.

System files are usually mounted in read-only mode, to permit a verification of them during the mount. This verification isn’t indicated if the files were mounted in read-write mode.

  • kernel prints: VFS: Mounted root (ext2 filesystem) readonly.
  • runs /sbin/init which is process number 1 (PID=1)
  • init prints: INIT: version 2.76 booting
  • can be changed with boot= parameter to lilo, eg boot=/bin/sh can be useful to rescue a system which is having trouble booting.

After these steps, the kernel will start init, which will become process number 1, and will start the rest of the system.

5) init process

The init process is the last step in the boot procedure and parent of all the other processes. This process is the first running process on any Linux/UNIX system, and is started directly by the kernel. It is what loads the rest of the system, and always has a PID of 1.

Init is responsible for starting system processes as defined in the /etc/inittab file.

The init process is never shut down. It is a user process and not a kernel system process although it does run as root.

Run Levels

0 halt

1 single user

2 Not used (user-definable)

3 Full multi-user mode (no GUI interface)

4 Not used (user-definable)

5 X11 Full multiuser mode (with GUI interface)

6 Reboot

Based on the selected runlevel, the init process then executes startup scripts located in subdirectories of the /etc/rc.d directory. Scripts used for runlevels 0 to 6 are located in subdirectories /etc/rc.d/rc0.d through /etc/rc.d/rc6.d, respectively.

Default is defined in /etc/inittab, eg:

o id:3:initdefault:

The current runlevel can be changed by running /sbin/telinit # where # is the new runlevel, eg typing telinit 6 will reboot.

If you are looking for hosting with the storage and performance to have more website features and deal with more visitors, check out our highly affordable VPS hosting packages.


Pin It on Pinterest

Share This