CentOS system Start-up process-2015090401

Source: Internet
Author: User

The CentOS boot can be divided into 4 main steps, as shown in:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/9B/wKiom1XoKbKydLKKAAEOx6wC624888.jpg "title=" image 022. PNG "width=" "height=" 280 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:280px; "alt=" Wkiom1xokbkydlkkaaeox6wc624888.jpg "/>

The first step : The motherboard power-on self-test, after the boot will run, for computer hardware such as CPU, motherboard, memory and other basic function detection. When the post detects a problem with the hardware part, it usually emits a unique indicative sound signal (such as ringing, two short, long, etc.) through the sound signal (the motherboard buzzer) indicating the fault location and the display output fault code or fault text description.

Second Step : Loading the boot Loader in the MBR: it is known that there are sometimes more than one hard disk on our host, that is, the host has the boot Loader in the MBR may not be more than a device, boot in the BIOS The sequence defines the boot loader in the MBR, similar to the boot entry---650) this.width=650; src= http://s3.51cto.com/wyfs02/M01/72/9B/ Wkiom1xolnrhnjrkaajvfzdbkgq915.jpg "title=" 2.png "alt=" Wkiom1xolnrhnjrkaajvfzdbkgq915.jpg "/>

Here you can set the boot loader (Grub) hardware device sequencing, according to the menu items, from the top down to find a bootable boot device, if the first time to find a bootable boot, even if the boot program is damaged, unable to boot, will not continue to look down The BIOS finds boot loader after loading the Grub menu, allowing the user to select the kernel to be loaded into the memory run;

The third step: from the GRUB configuration in the second step can find the location of the kernel, add it to memory, the kernel to self-extracting, expand the operation, and the hardware control to the kernel, grub out of memory.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/99/wKioL1Xo9dDQx1cLAAERHjYnifk752.jpg "title=" 1.png " alt= "Wkiol1xo9ddqx1claaerhjynifk752.jpg"/>

may needRAMDiskto assist in mounting the root file system, if the file system is on a special disk medium, or if the file system is compared(For example:Raid,Lvmwait), the driver for the device is not integrated in the kernel, so the root file system cannot be mounted, so you need to use theRAMDiskto assist in mounting the load. If the root file system isIdedisk, and the default file system format isExt2orExt3, even if there is noRAMDiskassistance, the root file system can also be mounted;RAMDiskoperation mechanism is to load a virtual root file system in memory to identify the real root file system required by the driver and load, after loading, the kernel can recognize the real root file system and mount it, at this timeRAMDiskthen switch the root to the real root filesystem and exit the memory itself;CentOS5on theRAMDiskto beInitrd,CentOS6on the But isInitrmfs, the reason for this improvement is because one of the features of the kernel is the use of cache pairs to speed up data access. Initrdis to communicate with the kernel itself as a disk device, soInitrdis already running in memory, and the kernel needs to load it again as a cache, which greatly reduces the efficiency of data access. SoInitrmfsis to communicate with the kernel itself as a file system running in memory.

As mentioned here, the default is to mount the root file system read-only, because to prevent the kernel out of the bug, resulting in the loss of root file system data, so that the system is not fully started before the completion, can only be read-only mount "/" until the system completely normal startup, The kernel then re-hangs the root filesystem in read-write mode.

When the above steps are complete, the first application that starts the kernel starts the user space : init(CentOS5), which is /sbin/init, takes CentOS5 as an example, The INIT program works specifically as follows:650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/M01/72/9D/ Wkiom1xo87earettaacuehlghtq669.jpg "title=" 2.png "alt=" Wkiom1xo87earettaacuehlghtq669.jpg "/>

in CentOS5, For example, first init sets the default level of system startup based on the settings in its profile /etc/inittab , set to : "Id:3:initdefault:" The meaning of the three fields here is:"id" is equivalent to the line number, remain globally unique,"3" is the default boot level of the system;Inintdefault represents the action that is performed by default after entering the definition level, and finally ":" followed by the process of execution. The third field here is Initdefault meaning to set the default, so the fourth fields are omitted, so the meaning of this line is to set the system default boot entry level 3;

There are 7 operating levels in the system :0 levels -6 levels

0 level: Shutdown

1 Level: Single-user mode, equivalent to Windows security mode

3 levels: Multi-user mode, just do not start the graphical interface

4 levels: retention level, and 3 level feature proximity

5 levels: Multi-user graphics mode

6 level: restart

When the first ID line finishes executing, execution executes the second line, in the form:

Si::sysinit:/etc/rc.d/rc.sysinit the meaning of this line of code is to perform system initialization at all levels, and the corresponding process is/etc/rc.d/rc.sysinit This script. The Init program executes this script to set the host name, read the/proc file to set system parameters, activate the LVM and raid devices, and other system initialization operations, The service script at the specified level is then started, with the following code:

L1:1:wait:/etc/rc.d/rc1

L3:2:wait:/etc/rc.d/rc2

....

L3:3:wait:/etc/rc.d/rc3

each line represents the start of the run level, and all of the service script links under the/ETC/RC.D/RC#.D (# stands for 0-6) directory under the specified level are started , close with the K The service script link at the beginning.

then, execute the configuration fields in the/etc/inittab:

Tty1:2345:respawn:/usr/sbin/mingettytty1

Tty2:2345:respawn:/usr/sbin/mingetty Tty2

...

Tty6:2345:respawn:/usr/sbin/mingettytty6

in order to set up the user terminal, at the 2345 level, each level will open 6 terminals, after the completion of the terminal setup, themingety program will call the login program to help users login verification;

when all of the above steps are complete, the/etc/rc.d/rc.loacl script is executed , in which the user can define commands or scripts to execute after booting.

System startup is complete.

That is: the CentOS Boot flow chart is summarized as follows: 650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/M02/72/99/ Wkiol1xo9gqx86mlaaikyykbd-0276.jpg "title=" image 005.png "width=" "height=" 402 "border=" 0 "hspace=" 0 "vspace=" 0 "style = "WIDTH:800PX;HEIGHT:402PX;" alt= "wkiol1xo9gqx86mlaaikyykbd-0276.jpg"/>

CentOS system Start-up process-2015090401

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.