This is one of the important questions in a Linux based interview. Both experienced and newbie techs can expect this question from interview board, and it is more confusing. A lot of explanations are available on Internet about Linux Booting Process.
In this post, I am exclusively focusing Linux newbies! ha ha as they are more confused on this topic 😀
Hey guys! Here, you can point out the basic operations or basic process which happens when a Linux machine start or reset.
The chart diagram for summarized booting process is added below.
I am going to explain Linux Booting Process based on the above flow chart. Do remember one thing, I am only adding the core processes while booting up a Linux machine, not a detailed explanation.
Have you ever wondered about the processes behind a system boot up? Yeah, as a SysAdmin, it’s very important to know about the steps and the processes in every steps while a machine boots up. Read more……
Step 1 : System startup.
Yeah, that should be the first step. To boot up the system you must startup the system first 🙂 In a PC, booting Linux begins in the BIOS at address 0xFFFF0. On an embedded platform, a bootstrap environment is used when the system is power ON / reset.
Normally, Linux is booted from a hard-disk where the MBR (Master Boot Record) contains the primary boot loader. The MBR is a 512 byte sector located in the first sector of hard disk (ie, sector 1 of cylinder 0, head 0).
Step 2 : Stage 1 boot loader.
As we stated, the stage 1 boot loader includes MBR section. MBR (Master Boot Loader), is a 512 byte sector located in the first sector of hard disk.
MBR contains both program code and partition table details. Please see the image added below:
First 446 byte are the primary boot loader which contains both executable code and error message text.
Next 64 bytes contains the partition table. This section contains records for each of four partitions. In the above image P1 represents Partition 1, P2 for Partition 2 and so on.
4 x 16 bytes = 64 bytes
The last two bytes known as magic number (0xAA55). This number is used for the validation check of MBR.
Step 3 : Stage 2 boot loader.
It is called the kernel loader. The main task at this stage is to load the Linux kernel.
Different boot loaders
LILO : Linux Loader.
GRUB : Grand Unified Boot Loader.
We use GRUB, as LILO has some disadvantages. One great thing about GRUB is it has knowledge about the Linux file system. GRUB can load kernel from an ext2 or ext3 file system.
In stage 2, GRUB can display a list of available kernels defined in /etc/grub.conf file.
Step 4 : Kernel
Here the kernel stage begin. Kernel is in compressed format. Kernel then initiate INIT on server, /usr/sbin/init.
Step 5 : INIT
After the kernel is booted, it starts the first user space application, ie run level program.
The run level program execute from /etc/rc.d/rc*.d/
That’s it! Your machine is booted with the preferred run level.
This is only a quick reference topic. Let me know your suggestions as comments.