Saturday, July 20, 2013

Linux Booting Process

Booting is an important process of any operating system, you should know how this process began. When a computer start up booting process began in following sequence.

1-The BIOS is the first program that is run. After it is loaded,

2-The BIOS begins to test the system through the Power On Self Test (POST) and then starts loading peripheral devices.

3-The BIOS then looks for the boot device and passes control to it.

4-The boot device contains the master boot record (MBR), which starts to boot the system via the bootloader.

5-The Grand Unified Bootloader has become the default bootloader for Red Hat, Ubuntu, and many other versions of Linux

6-When GRUB loads, you are given a list of kernels and additional operating systems (if available) from which you can choose to boot. By default, there is a configurable 5-second timeout value that chooses the default kernel if you don’t select manually.

7-After GRUB loads the kernel, it passes control over to the kernel, which in turn begins to initialize and configure the computer’s hardware. During the boot process, everything is logged to the /var/log/dmesg file.

8-When the required system’s drivers are in place, the kernel executes the /sbin/init program.

9-The init program is the first process created by the kernel. It is responsible for the rest of the boot process and setting up the environment for the user.

10-Finally now you can login in your system.

The above section described the boot process and how it works. The first part of that process deals with the bootloader, GRUB. In this section, we look at GRUB and its role in the boot process more in depth.
The GRUB bootloader is broken down into different stages. The code contained on the master boot record (MBR) is considered GRUB stage 1. It loads GRUB stage 1.5, which tries to identify the file system type (optional), or it can call GRUB stage 2 directly. Stage 2 calls the kernel and loads it into memory. In stage 1, GRUB needs to search the MBR looking for an active partition from which to boot the kernel. GRUB has its own format for looking through hard disks.
The syntax of this format is:
(xdn[,m]) where xd is the drive, n is the number of the disk, and m denotes the partition number. As stage 2 starts, it presents you with a list of kernels along with a listing of options that you can use to modify the parameters passed to the kernel during boot up. Now let’s look at how to edit those entries:

Grub Boot Options:
e Edit the commands before booting
a Modify or append the kernel arguments before booting
c Open the GRUB command line

You can use the a option to modify any parameters you want to pass to the kernel. This includes changing the runlevel that the system will boot.
Here are the different modes that you can boot into:
Single-User Mode Used to perform maintenance tasks such as forget the root password
Runlevel 2 or 3 Used to load only partial services during the boot process
Emergency Mode Used to perform tasks on an unbootable system
Rescue Mode Used to fix boot issues and reinstall GRUB

No comments:

Post a Comment