End to End Linux Booting Process
Linux Booting Process:
Once We start our Linux machine, it will start the booting process by passing request to BIOS.
BIOS stands for Basic Input/Output System. In simple terms, the BIOS loads and executes the Master Boot Record (MBR) boot loader.
BIOS (it is auto loader)
(BOOT Strapping)
| -- CMOS (It has HDD Device Boot priority)
| loas HDD (Go to 1st sector, 0 cylinder)
| -- MBR (here it loads MBR)
|-- LILO
| -- /boot/boot.b
| -- /boot/message (splash screen)
| -- /boot/map
| -- /boot/vimluz (kernel loads)
| -- /boot/initramfs
| -- JBD.KO (kernel object) (JBD :- Jbod , which is HDD driver)
| -- ext4.ko (file system Driver)
| -- nash (minimal shell)
| -- mount /dev/root / ro ( this is called SETUPROOT) ( ro means read only, this command will search for the " / " driver name)
| -- mount /dev/sdax ro (this is called SWITCHROOT, this command will mount the "/" on the mount point given by previous command)
( this is done in read only mode, because after mount we do fsck check, the fsck check will be done on read only mode)
*** mounting means, making the file system available and assigning Inode numbers
++======================= up to here " Kernel space finished " ======================
=========================next " users' space " =========================================
**before the mounting of " / ", files will be loaded using CHF number, after mounting files will be loaded using Inode numbers
** init/systemd is the father of all the process under the " user space "
** /sbin/init file will be loaded after the mounting of " /", by the use of Inode number
/sbin/init (this will loads inittab )
|-- /etc/inittab ( this will load the run level and rc.conf)
| -- check runlevels
| -- /etc/init/rcs.conf
| -- /etc/rc.sysinit
( this is called system initialization file and also called SYSTEM -V file) (this is an important file, and it loads only once at Booting time)
( this file will contain all the below commands and process, these will be loaded with this rc.sysint file: - we can open this file and check all these files, which start at booting)
| -- HOSTANME
| -- /etc/sysconfig/network (YES or NO) (it will check in file /etc/sysconfig/entwork :- networking=yes or no, if it is yes then networking ON, if it is No then netwoking is OFF)
| -- start_udev (this will initialize the drivers)
| -- /etc/redhat-release (while booting the system we are getting welcome to CentOS 6.4) this will come from this command
| -- /fastboot (this file doesn’t exist, but if we create this file under " / " then all fsck check will be skipped while booting of OS, to make the fast book)
(One more file /forcefsck :- will make fsck check mandatory (not important))
| -- /forcefsck
| -- fsck + fstab
(Here in fstab file read and all the partitions are mounted, but " / " is already mounted right (so what happens, up to here " /" is in read-only mode mounted. so here " /" will be remounted in read write mode, and all reaming partitions are normally mounted)
| -- /etc/sysconfig/read-only-root (In this file if we keep readonly=yes, then complete OS will enter into read-only state)
| -- /var/log/dmesg ( BIOS update Hardware info in DMESG)
** and here /etc/rc will load by /sbin/init
** TASK: - change the color of the OK signs while booting, and change the OK to some other word
RHEL 1 to RHEL 6 runlevels 7 and RHEL 7 no runlevels (we have targets)
/etc/rc ( rc is responsible to start and stop all the services) (rc means runlevel control) ( like this in windows services.msc)
| -- chekc runlevel and starts the services depending on runlevel
| -- /etc/rc$.d/K* ( here K* means file stating with K, K means file will be killed) (all K files will be skipped, when we do a fresh reboot)
| -- /etc/rc$.d/S* (here S* means file starting with S, if s is there, files will be started)
| -- /etc/rc.local (whatever we enter in this file will run, once the booting is done, example: - if we want to create a file before the login, then enter in this file: - touch /opt/testfile. then this file will be created before the login)
(This file runs before the login page comes)
/sbin/mingetty (this is a program used to do logins) (this is for runlevel 3, in runlevel 3 then this mingetty script will be loaded first)
| -- /bin/login
| -- /bin/password
/sbin/mingetty
| -- it loads 6 ttys and keeps 5 ttys in sleep and 1 tty in active (so ttys also loaded by mingetty )
| -- /ete/issue (this file shows the info, which will be displayed at the login prompt (ex: - CentOS and kernel version), even we can modify this file and change the display content)
| -- /bin/login (this is the file, which asks the " username"
| -- /bin/passwd (/bin/login will call password file: - it asks for password ... ,: and here stty -echo will be added to password, that why we cannot see password)
| -- /etc/passwd
| -- /etc/shadow
| -- /etc/group
| -- /root/.hushlogin (if we create this file then: last login ad /etc/motd will be skipped)
| -- last login
| -- /etc/motd (message of the day) (this is the message we get once the login is done, write whatever we want to display)
| -- /bin/bash (this bash is loaded by /bin/login file)
| -- /etc/profile (global user settings) (these files are loaded after the login, whereas /etc/rc.local file loads before the login)
Below things are loaded after login:
| -- path
| -- HOSTNAME
| -- HISTSIZE
| -- /etc/profile.d/*.sh (if we want to run some scripts after login, place in this folder with " .sh " tag then these will run at time of login.
| -- /etc/bashrc ( profile and bashrc are same type files, difference is path related settings (Core User) will be done in profile file and Shell related settings (like umask) will be set in bashrc)
| -- UMASK
| -- PS1 (PS1 means: - command line display prompt)
| -- /home/$user/.bash* (users specific profile file)
Comments
Post a Comment