๐๐ข๐ง๐ฎ๐ฑ ๐๐จ๐จ๐ญ๐ข๐ง๐ ๐๐ซ๐จ๐๐๐ฌ๐ฌ
The booting process is the first step in starting a Linux-based system and understanding it is crucial for maintaining and troubleshooting the system.
As a DevOps engineer, you will be responsible for ensuring that the system is running smoothly and efficiently. This includes tasks like configuring servers, installing software updates, and monitoring system performance. To do these tasks effectively, you need to have a clear understanding of how the system works from the ground up, including the booting process.
Knowing the boot process of a Linux system can help you identify and fix issues that might arise during boot time. You can also use this knowledge to optimize the booting process and make it faster, which can help to improve system performance.
In essence, understanding the booting process can also help you to diagnose problems with the hardware or firmware that might be causing issues with the system. This knowledge can help you determine whether a problem is related to the hardware or the software, which can save you a lot of time when troubleshooting issues.
Overall, knowing the Linux boot process is an important skill for any DevOps engineer who wants to be able to effectively manage and maintain a Linux-based system.
Booting process:
BIOS / UEFI: Modern firmware [in CMOS chip in every machine]
The process of verifying system components i.e. POST [Power-On Self Test] at startup can be described as follows:
First, the BIOS
scans the hard disk for the Master Boot Record (MBR).
Once the MBR
is found, control is transferred to GRUB-2
.
Next, GRUB-2 loads the kernel, specifically handing over control to the "vmlinuz
" kernel while also indicating the location of the "initramfs
" file system initialization in memory.
The kernel, known as "vmlinuz
," is responsible for initializing all necessary hardware and locating all modules (also known as drivers) in the "initramfs" file system. Afterward, the kernel executes "/sbin/init
" from initramfs as the process ID, or PID, of "1". This is typically the "systemd
" process.
After being initiated from "initramfs
," the "systemd
" instance executes all units associated with the "initrd.target
" target level or levels. This involves performing various tasks, such as mounting the actual root file system on /sysroot
. It's important to note that the file system is read-only at this point, indicating that the "fsck" process has been completed.
Summary:
First, the BIOS scans the hardware to identify and initialize system components.
Next, the bootloader, such as GRUB-2 [grub.cfg file]
, loads the kernel and initializes the RAM file system, or initramfs.
Once the kernel is loaded, it executes the "systemd" process, which in turn executes all units associated with the "initrd.target"
target level.
This includes mounting the actual root file system on /sysroot, which is read-only after completing the file system check, or the "fsck
" process.
Finally, the root file system is mounted as read-write, and the operating system starts up, loading various services and applications as needed.
For the inquisitive ones:
There are 2 types of beeps in the booting process to indicate issues:
3 Long beeps
2 short beeps
MBR is 512 bytes, out of which MBR:GRUB-2 takes 446
bytes and remaining 64
bytes are for partition tables.