Linux system Startup process overview

Source: Internet
Author: User


As a Linux OPS personnel, we need to have a certain understanding of the Linux startup process, in the course of work, if you encounter a startup failure, we can more easily troubleshoot.


Let's describe the entire startup process first, such as:


650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/87/3A/wKioL1fYMBKjoJn4AAASIRYwBlA918.png "title=" Start the process. png "alt=" Wkiol1fymbkjojn4aaasirywbla918.png "/>

The above process for the entire START process of the general process, each step specifically done, we can refer to the following summary:

1. POST  

power-on Self Test (POST), after power-on, the instructions that are cured in the firmware are loaded into memory, the CPU

Reading these instructions from memory, these instructions check each hardware to see if the hardware is functioning properly.

2. BIOS (Boot Sequence)

Remember the startup item that we set in the BIOS, the BIOS will find the first device that can be started

is set to boot from the hard drive, the BIOS will scan these hard drives, find the hard drive that can be started, and discover the presence of MBR

The hard drive.

3. MBR (Bootloader,446byte)

The first 446 bytes of the mbr,mbr of the first boot drive are read, which is the initial stage of the Grub boot program, but

446 bytes alone is not able to complete all the boot work, the only effect of these 446 bytes is to find the grub boot

The code for the next phase of the program, through phase 1th, finds Grub's code for phase 1.5, and Grub's phase 1.5 store

On the 0 cylinder that starts the hard drive, there is not only stage 1.5 of grub on the 0 cylinder of the boot drive, but also the boot partition file system

Should be the driver, why do I need boot partition file system driver? Because grub is large, GRUB has a 2nd-stage code,

The 2nd phase of GRUB code is stored in the/boot partition, so if we want to get full grub,

You must be able to enter the boot partition and want to mount the boot partition, you need to have the boot partition corresponding to the file system driver.

This process can be understood, we find grub stage 1.5 through grub Stage 1, and then find it through Grub stage1.5

After driving to boot partition, mount the boot partition and locate Grubstage 2.

4, Kernel

Boot partition is mounted, grub is complete, grub continues to work, read grub.conf file, grub.conf file specified in

To load the kernel, load the kernel files in the boot partition into memory, and unzip in memory, we know that the core of Linux is inside

The kernel file is stored in/boot, and the boot partition is sure to read the core file in the partition where boot is

There are file systems (here we assume that boot is a separate partition), if you want to be able to use the boot partition, you must obtain the boot

Partition of the file system corresponding to the driver, then, when did we get the boot partition file system driver? is on the

Step, grub in the 1.5 phase, get to boot partition driver, when we install the operating system, the boot partition corresponding to the text

System must be a standard file system, such as the Ext file system, when we determine the boot partition's file system, then the file

The drive size of the system is determined at the same time, so where grub stage1.5 can find the driver for the boot partition, it can

It's OK.

5, RAMDisk or Ramfs:initrd/initramfs (pseudo-root)

In the previous step the kernel has been loaded into memory, this time, the kernel should go to mount the root partition, but this time the kernel encountered a question

The root partition is a file system, if you want to use the root partition, the kernel must obtain the root partition corresponding to the file system driver, then,

Where does the kernel go to get the file system driver for the root partition, the answer is from the boot partition's initramfs*.img file,

Initramfs*.img This file is generated when we install the operating system, we specify the root partition when we install the operating system

What file system is used, so initramfs*.img knows what filesystem the root partition corresponds to, thus initramfs*.img also saves

The root file system corresponding to the driver, when the initramfs*.img this file is loaded into memory, it will be disguised as a root file system, inside

When the kernel needs to get to the real root filesystem driver, it will go to this pseudo root to find the file that gets to the real root partition

System corresponding to the driver , get the real root partition of the file system, you can mount and use rootfs .

6, (ROOTFS) init (/etc/inittab) (user space-led process)

Bootloader kernel and Initrd/initramfs are loaded into memory, kernel and INITRD are located in the boot partition, and the boot partition

A basic disk device so that bootloader access and load into memory, kernel in memory, kernel gain control,

Kernel access Initrd,kernel with the driver or module in INITRD, the final access to Rootfs, Rootfs found in/sbin/init,

Initialization of the program in user space is done by Init. Init reads configuration file/etc/inittab, performs/etc/rc.d/rc.sysinit initialization

Script that initializes the specified process for the system.


This article from the "School Thinking Line Know" blog, declined reprint!

Linux system Startup process overview

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.