Pages

Saturday, June 24, 2017

A Basic Guide to Linux Boot Process

As promised in our earlier post, in this post we are going to review boot process in Linux Operating System. How Operating system passes through different stage of booting states. This article is written for those readers who has just steps in Linux world. Understanding how Linux boots up is very important in terms of effectively troubleshooting in case of system failure. When a system switched on and after few moment we get a login prompt. Have we try to find out what all stage of booting sequence has crossed and what happened behind the scene during system boots up.

Linux Boot Process
Linux Boot Loader Process

Power on

  1. BIOS (Basic Input Output System) is a software program comes pre-built in a motherboard chipset.
  2. BIOS loads and scans for devices such as Hard DiskCD-ROMRAM, etc.
  3. BIOS searches for MBR (Master Boot Record: 1st sector) of the primary hard drive, it scans for 1st stage loader (In our case boot loader is (GRUB LILO) and hands over the responsibility to MBR.
  4. Boot PROM/FLASH/BIOS is proficient of loading the MBR into RAM and executing it.

MBR (Master Boot Record)

  • 512 bytes of space –> MBR
  • MBR contains the information of loader of most operating system e.g UNIXLinux and WINDOWS
  • MBR holds the small binary information of 1st stage of loader
  • MBR consist physical sector of the first disk drive (i.e 512 bytes) and it’s not part of any partition.
  • Placed on the prime disk drive, in the prime sector of the first cylinder of track is 0 and head is 0 (this whole path is generally booked for boot programs)
  • MBR involve a mini executable programs and a table specify the primary partitions.
Boot Code (GRUB) 446 bytes
partition 1: 16 bytes
partition 2: 16 bytes
partition 3: 16 bytes
partition 4: 16 bytes
magic Number: 2 bytes
  1. MBR also document which primary partition is ACTIVE.
  2. The BIOS surrender rights to the first stage boot loader, which then scans partition table and finds second stage boot loader on the partition configured as bootable.

Boot Loader

  1. The boot loader termed from 1st stage loader and loads itself into RAM. All this go on in milliseconds.
  2. The default stage 2 boot loader is a GRUB (Grand Unified Boot Loader) or LILO (Linux Loader)
  3. Once GRUB is loaded into RAM, then it’s search for the location of Kernel.
  4. GRUB will scrutinize the map file to find the kernel image, that is located under (/boot) and load it.
  5. GRUB loads the kernel (vmlinuz-version) from /boot partition

Trivia 1

GRUB organize RAMDISK for initrd —> (RAMDISK is reserved space from RAM). In addition, it drives initrd into RAM to ready the kernel for loading itself into memory and depended modules so that it can leave the system to “init” process
In, Linux most of the drivers are pre-built as modules, these would be initial ram drive (initrd.img) where it can keep all the information of additional modules. So, when the kernel boots, it creates ramdrive, loads the initrd.img and its depended modules.
GRUB reads /boot/grub/grub.conf & shows us a clean interface for selecting Operating System.


      ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
                                                    ► Read more: http://adf.ly/1n7SX8

      ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

No comments:

Post a Comment