Analysis of Linux system boot process-linux Boot tutorial

Source: Internet
Author: User
Tags set time dmesg

1: After the power supply, the first step of the host is to query the BIOS (full name: Basic input/output System) information. Understand the hardware status of the whole system, such as CPU, memory, video card, network card, etc. Well, this step windows calculates and it's a. equals

2: Next, the host reads the MBR (the first sector of the hard drive) in the boot loader. This is the point oh, it is said that troubleshooting in the exam this, to a broken loader, asked you to amend. Windows does not support the Linux partition format. So, with Windows boot. INI is not found on Linux systems. Generally I install the system is first installed Windows and then install Linux, and then use grub to do boot loader. Two words: Worry! Because Linux is not as stingy as windows. GRUB is supported by Windows partition format OH.

3: Next step, the host read the boot loader, will read the information inside, know who and who is to stay, if the host wants to enter the Linux system, read to Linux core is in the/boot file directory, the core loaded into memory. Began the next analysis of the start of the trip.

4:ok, who is the first running program? is the/sbin/init program. Do not believe that the top program to look at, is not the PID 1 is this dongdong, it, but the ancestors of all things, I referred to it is Nu wa Empress (do not like Adam and Eve).

5:init first find the boot level (run-level). Because the startup level is different, the script (that is, the service) will be different. The default level has the following:
0-halt (direct shutdown of system)
1-single User mode (single player, used for system maintenance)
2-multi-user, without NFS (similar to 3 mode, but less NFS service)
3-full Multi-User mode (full pattern, however, is text mode)
4-unused (System retention function)
5-x11 (similar to 3 mode, however, is the X terminal display)
6-reboot (reboot)
(Do not choose 0 or 4, 6 otherwise, progressive system)

6:ok. The system knows its starting level, next, not to start the service, but, first set up a good host operating environment. The file read is/ETC/RC. D/RC. Sysinit files. What kind of environment do you want to set up?
· Set up the network environment/etc/sysconfig/network, such as host name, Gateway, Ip,dns and so on.
· Mount/Proc. This file is a special file with a size of 0 because it is in memory. It's best not to delete the inside stuff.
· Based on the results of the kernel in the boot/proc/sys/kernel/modprobe. Start the detection of peripheral equipment.
· Load user-defined module/etc/sysconfig/modules/*. Modules
· Read/etc/sysctl. conf file to set the kernel.
· Set time, terminal fonts, HDD LVM or RAID capabilities to fsck for disk detection.
· Log the boot status to/VAR/LOG/DMESG. (You can view the results with the command DMESG)

7:ok, Next, is to start the system service, different run-level will have different service startup. To/ETC/RC. D directory, different level will have a different table of contents. If you start 3 mode, there will be a RC3. D directory, the inside is to keep the service. Where the beginning of the S (start) indicates that the boot starts, K (kill) begins with the indication that the boot does not start. Numbers indicate the start order. The smaller the number, the sooner it starts.

Note that they are all connected to the ETC/RC. D/init. The related files in the d/directory. So, want to start a service by hand, can use "/ETC/RC." D/init. D/A service start "start up" Oh. Instead, we can also put a service ln (link command) into a different run-level directory. Remember to call the S or K + numbers.

8: After reading the service, the main opportunity reads/ETC/RC. D/RC. The local file. So, if you need anything to boot up, you can write a script or command to come here. It's not as much trouble as it is. It is also convenient to delete it later.

OK, after a long journey, the system can finally open the shell at ease. Put the control in our hands. We can do whatever we want. Best, develop good habits, do not normally use root user landing. Last time I accidentally lost Poweroff. That's a gateway server. The whole company is not on the net. Luckily, they're already warm. Just mad K me a meal.

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.