Beruflich Dokumente
Kultur Dokumente
Have you ever thought that what process executes as soon as we switch on
our machine and then to the login prompt?
As soon as we switch on our machine, it has no idea what to do, the first thing
that happens is Bios is loaded. Then Bios searches for MBR( First sector of
the bootable device) and BIOS handover control to it. MBR looks for boot-
loader once boot loader is loaded into memory it loads kernel and initramfs.
After that file system is mounted. Mother process gets executed the by kernel
i.e init/ systemd and it runs all the other required process and then login
prompts comes.
http://www.linuxbuzz.com/step-by-step-linux-rhel-6-7-boot-process-for-beginners/ 1/8
9/21/2018 Step by Step Linux (RHEL 6 / 7) boot process for beginners
BIOS
Basic input/ output system. It is a program that is stored in read-only
memory chips on the motherboard of the computer.
http://www.linuxbuzz.com/step-by-step-linux-rhel-6-7-boot-process-for-beginners/ 2/8
9/21/2018 Step by Step Linux (RHEL 6 / 7) boot process for beginners
As soon as our computer is ON, this is the program that gets executed
first. It runs regardless of what OS you have installed on your machine. It
is not associated with any Operation system. Bios Setup can be changed
by pressing F12 or F2.
Once this program is executed, it checks if the basic hardware of machine
which is required to start the machine is working properly or not. Like
the keyboard, RAM, visual display unit etc. This process of checking basic
hardware components if they are working fine or not is known as a POST(
power on self-test).
After POST BIOS check for a bootable device. From where, OS can be
booted. The bootable device can be anything like hard disk, floppy disk,
pen drive. Once BIOS find the bootable device it handovers control to the
first sector of the bootable device, which is MBR. If in case of BIOS do not
finds any bootable device then BIOS gives an error and machine boot
process is stopped.
There is no way to switch from BIOS of UEFI, you need to buy new
hardware that includes UEFI, as most of the machine now comes with
UEFI. UEFI support GPT partition instead of MBR.
MBR
Master boot record. Its size is 512 bytes. It is the first sector of any bootable
device. It is divided into 3 parts.
First part is bootloader and size of this partition is 446 bytes, second is of 64
bytes (partition table info) and third is of 2 bytes (used for error checking).
http://www.linuxbuzz.com/step-by-step-linux-rhel-6-7-boot-process-for-beginners/ 3/8
9/21/2018 Step by Step Linux (RHEL 6 / 7) boot process for beginners
MBR job is to look for boot loader ( LILO/GRUB IN case of Linux) and
hand over control to it.
Boot loader
• It gives you options from which OS or kernel you would like to boot your
machine (only if you have multiple OS or kernel installed on the machine).
In the above image, we can see we are getting 2 options from which we can
boot machine.
Its main job is to load kernel and initrd /initramfs image in memory.
Once boot loader loads kernel in RAM it passes control to Kernel.
NOTE: In RHEL7
Kernel :
Initially, the kernel is loaded in read-only mode.
Kernel initializes the first process that is init(Till RHEL6)/Systemd( from
RHEL 7).
The kernel manages memory, input-output device. In short, it controls
the overall system.
Kernel is compiled with different drivers but they are not able to load
actual file system because some additional drivers are required for it.
For this purpose, intird/ iniramfs is loaded in RAM, so that it can install
other drivers which are required to load actual file system.
Initramfs/initrd gets decompressed and then it first loads temporary file
system.
Initrd /Initramfs:
It loads temporary root file system into memory.
It contains a minimum set of directories and acts as a bridge to the
real/actual file system.
Is detects what all device drivers are needed to load the actual file system
and it loads them from a temporary file system. After that, other
partition like LVM, RAID etc is mounted then initrd is unmounted.
We can see kernel and initramfs file in /boot directory. Staring with
vmlinuz denotes kernel.
http://www.linuxbuzz.com/step-by-step-linux-rhel-6-7-boot-process-for-beginners/ 5/8
9/21/2018 Step by Step Linux (RHEL 6 / 7) boot process for beginners
Successor of initrd (initial ram disk) is Initramfs ( initital ram disk file
system) . Feature made up from a cpio (copy input and output) archive of
files that enables an initial root filesystem and init program to reside in
kernel memory cache, rather than on a ramdisk, as with initrd
filesystems.
Initramfs is used by 2.6 kernels whereas initrd was used by older 2.4 (and
earlier) kernels.
Once the real file system is mounted, then kernel runs the first process i.e
init( till RHEL 6) / Systemd from (RHEL 7).
Init
http://www.linuxbuzz.com/step-by-step-linux-rhel-6-7-boot-process-for-beginners/ 6/8
9/21/2018 Step by Step Linux (RHEL 6 / 7) boot process for beginners
Once all required services and script are executed user gets login prompt.
But from RHEL 7 init and runlevels are replaced by systemd and targets
respectively.
Systemd
Same as init it is the first service started by the kernel, with process id 1.
“ d” in system d stands for a daemon.
Daemons are the programs that run in the background performing
various tasks.
Services usually refer to one or more daemons.
Configuration file : /etc/systemd.
1. In init, one script runs at a time, while in systemd multiple scripts run at
a time parallel. Thus increasing the performance.
2. In init, an administrator has to take care of what scripts should run
first.Init process does not know if the scripts defined in particular
runlevel are dependent on another script, while systemd takes care of
dependency.
3. Systemd kills daemon properly before the machine shuts down.
4. inittab is no longer used when using systemd.
5. systemd uses ‘targets’ instead of runlevels. By default, there are two main
targets:
http://www.linuxbuzz.com/step-by-step-linux-rhel-6-7-boot-process-for-beginners/ 7/8
9/21/2018 Step by Step Linux (RHEL 6 / 7) boot process for beginners
systemctl get-default
So, this is all about the boot process of Linux and system.
http://www.linuxbuzz.com/step-by-step-linux-rhel-6-7-boot-process-for-beginners/ 8/8