Friday, January 1, 2021

Booting process and Kernel

 

Booting

Whenever we  power on the system and server. The system runs and check all self  hardware and software and detects all the connected input and out peripherals device. This process is called POST (Power On Self Test). If It is found any errors .It displays on the screen.Linux booting process is working How it is work at behind the process review by linux user .


 Booting process is done in 6 stages


BIOS :

BIOS stands for Basic Input and Output System. BIOS locates the booting disk in the system and it is locates disk and It is loads the Primary boot loader in disk .
Simply  the BIOS loads the MBR into memory and it is executes the MBR at disk.

MBR :

MBR stands for Master Boot Record. It is found in the 1st sector of the bootable disk (like that  /dev/hda or /dev/sda).
MBR is size 512 bytes and There is three components.
First part is Primary boot loader information and its size is 446 bytes.
Second part is Partition table information and its size is 64 bytes.
Third part is MBR validation check and its size is 2 bytes.

The primary boot loader contains the secondary boot loader we can say GRUB but GRUB or (LILO in old systems).Then primary boot loader find secondary bootloader and loads the secondary boot loader into memory.
So simple way  the MBR loads in secondary boot loader and It is executes the GRUB boot loader.

GRUB  :

GRUB stands for Grand Unified Boot loader It is used in Linux 7. LILO stands for Linux Loader and it is used in old Linux O.S(below 6.0). We have multiple kernel images installed in our O.S, we have option so we can execute as per your choose.
GRUB displays a splash screen, wait for few seconds. If we do not select anything, it loads the default kernel image in the grub configuration file.
GRUB has the information of the file system (but  old LILO didn't have information of file system ). GRUB configuration file is /boot/grub/grub.conf . This file have  kernel and initrd images. So, in simple terms GRUB just loads and executes kernel and initrd images.


init level :

Init program reads the /etc/inittab file and It is choose specified default run level from /etc/inittab file and put the into system .we can change the this default run level whenever we needed. We can find default run level by using command #cat /etc/inittab
Other command using.
# systemctl get-default

Now You want to change run level .
#systemctl set-default graphical.target
Temporary change
#init 3 (CLI RUN LEVEL) .

#init 5 (GUI RUN LEVEL)

The following run levels are vailable in Linux systems.

0 -----> halt or shutdown the system
1 -----> Single user mode
2 -----> Multi user without NFS
3 -----> Full multi user mode but no GUI and only CLI mode
4 -----> Unused
5 -----> Full multi user mode with GUI (X11 system)
6 -----> reboot the system


How to check the default run level in linux

To see the default run level in linux the command is
                       
                             root@server~#who –r


You want to changing the default run level to some  like 3

To change the run level edit the /etc/inittab and make the following changes
                  
Permanent Change
            
                             root@server~#vim /etc/inittab
go to last line change id:3
then reboot system:
                             root@server~#init 6

Temporary Change
                            root@server~#init 3

To see the details regarding the kernel installed

                              root@server~#uname –r

To see the same thing with more details use                             

                            root@server~#uname –a


To check the architecture of the O/S

                              root@server~#uname –m

To check the version of the O/S in the system

                      root@server~# cat /etc/redhat-release

The difference between # reboot and # init 6 commands .

Both commands are used to restart or reboot the system.

# reboot

Reboot command  do not send the kill signals to the system and it will kill all the running processes or services forcefully  then restart the linux system.

# init 6

Init 6 command  send the kill signals to the system and it will stop all the processes and services one by one and  restart the system.



No comments:

Post a Comment