Operation and maintenance interview questions-Linux system startup process

Brief description:

1. Boot BIOS self-test

2.MBR boot

3.grub boot menu

4. Load the kernel kernel

5. Start the init process

6. Read the inittab file, execute rc.sysinit, rc and other scripts

7. Start mingetty and enter the system login interface

Insert picture description here

The startup process of the Linux system can be divided into the following steps:

POST (power-on self-test) -> load BIOS (Basic Input/Outpu System) -> confirm the boot device (Boot sequence), load the Boot Loader -> load the kernel (kernel) to initialize the initrd -> run /sbin/init to initialize the system- >Print user login prompt

1. Power-on self-check, load BIOS information

CPU related information, device startup sequence information, hard disk information, memory information, clock information, etc.

2. MBR boot

The 0 cylinder 0 track 1 sector of the hard disk is called the MBR (Master Boot Reord) master boot record, the size is 512 bytes, which stores pre-boot information, partition table information and partition flags, etc.; it is divided into two parts: the first part It is the boot area, which occupies 446 bytes, the second part is the partition table, which occupies 66 bytes, which records the partition information of the hard disk (the first 64 bytes are the partition table information, and the last 2 bytes are the partition end identifier)

3. Grub boot menu

The /etc/grub.conf file is a link file. The system reads the grub configuration information in the memory and starts different operating systems according to this configuration information

[root@c69-01 ~]# ll /etc/grub.conf 
lrwxrwxrwx. 1 root root 22 Feb  2 21:37 /etc/grub.conf -> ../boot/grub/grub.conf

4. Load the kernel kernel
5. Start the init process

In the process of system booting, /sbin/init is the first program loaded by the kernel, so the PID corresponding to the init process is always 1.
This file will read the /etc/inittab file and perform initialization work based on this file

6. Read the inittab file and execute scripts such as rc.sysinit and rc

Read the /etc/inittab file to obtain the system operating level, such as level 3, text mode or character mode
/etc/rc.d/rc.sysinit, the first user-level file executed by the Linux system, set PATH, set Network configuration, start swap partition, set /proc, etc., perform initialization work
/etc/rc.d/rc*.d/* Start the script program corresponding to the system run level, such as run level 3, start /etc/rc. All the files in the d/rc3.d/ directory, these files are soft link files, pointing to /etc/init.d/*
execute the /etc/rc.d/rc.local file, which is self-starting self-starting configured by yourself Files, self-developed programs, scripts, etc.

7. Start mingetty and enter the system login interface
Insert picture description here

Note: The system I use is: CentOS release 6.9 (Final)

Reference: Briefly describe the boot process of the linux system from booting to the login interface

Reprint: Linux system boot process (brief description)

Guess you like

Origin blog.csdn.net/XY0918ZWQ/article/details/113761299