Linux Boot Sequence
Power -on- power self-Test (BIOS)- hardware Check
-MBR(Locate the system that needs to be started, because more than one system may be installed on the actual computer)
-bootloader system initialization, loading of Kenel to memory
- kernel execution, determine which devices require driver initialization, mount the root file system, start the first process init
- start/etc/rc.d/sysinit
(This is the first script executed by Init, in Redhat,/etc/rc.d/ Rc.sysinit mainly do the same initialization work in each mode of operation, including: Incoming Keymap and system font, start swapping, set hostname, set NIS domain name, check (fsck) and Mount file system, open quota, load sound card module, set system clock)
(Rc--run command to run commands, D-Wizard process, the startup process can not see the process, etc files are very important configuration files, do not mess with the changes)
- Load other modules (memory, hard drive, optical drive, etc.)
-Run Levelscript(/ETC/RC.D/RC $RUNLEVEL # $RUNLEVEL is the default run mode, up to 6 levels, the program started at each hierarchy is different, there is no relationship between the levels)
- Execute/etc/rc.d/rc.local(very important, after installing Tomcat, you need to set it to modify this at boot time)- execute/bin/login-shell boot
Development: Linux boot process
After the system power-up, the first hardware self-test , then the bootloader to the system initialization , load the kernel . Once the kernel is loaded into memory, it starts executing. Once the kernel is up and running, the hardware detection determines which device drivers need to be initialized (the hardware detection is different from the previous hardware self-test, which is the system checks the hardware to determine whether it needs to be initialized). From here, the kernel is able to mount the root filesystem (a process similar to that used by Windows to identify and access C-disk). After the kernel has installed the root filesystem and has initialized all device drivers and data structures, the boot process is completed by launching a user-level program called Init.
Expansion: Boot order
Init A process is the first user process after the system starts, so its PID (process number) is always 1. the first thing to do on the init process is to read the Initdefault ID value in the Inittab file in the/etc/directory , which is called the RunLevel (Run-level). It determines the level at which the system runs after it is started. The operating level determines most of the behavior and purpose of the system startup. this level is from 0 to 6 and has different functions. The different run-level definitions are as follows:
# 0-Stop (do not set the Initdefault to 0, or the system will never start)
# 1-Single user mode
# 2-Multiuser, no NFS
# 3-Full multi-user mode (standard run level)
# 4– system Reserved
# 5-x11 (x Window)
# 6-Reboot (never set Initdefault to 6, otherwise it will be restarted)
Expansion: The relationship between/etc/rc.d/and/ETC/RC.D/INIT.D
Here, let's explain what's in the INIT.D. This directory contains scripts that are typically startup scripts for some of the services that Linux has set up to install with RPM packages. The system is installed in a lot of RPM packages, where there are many corresponding scripts. executing these scripts can be used to start, stop, and restart these services.
As mentioned earlier, the/etc/rc.d/init.d script in this directory is similar to the registry in Windows, which executes when the system starts. program to run here (the INIT process read the RunLevel), I believe from a named point of view you can also guess the script inside the run/ETC/RC.D/INIT.D, or why it is also called INIT.D it. Yes, it's time to run the script in the INIT.D, but not directly, but selectively because the system doesn't need to start all of the services.
So, how does the system choose which needs to start and what not? At this point, the level of operation that was just said worked.
after the system-initiated run level is determined, the/ETC/RC.D/RC script executes first. in the source code of RH9 and FC7 it is a check_runlevel (although the implementation of the code is not the same, but also the same), after knowing the RunLevel, for each runlevel, under the RC.D have a subdirectory is rc0.d,rc1.d ..... Rc6.d. Each directory is a subset of the scripts to the INIT.D directory for some links. each level to perform which services in the corresponding directory, such as Level 5 to start the service is placed under the RC5.D, but placed under this rc5.d are some linked files, linked to INIT.D in the corresponding file, the real work of INIT.D script.
Outreach: The role of RC?.D
RC?. D -in? Represents a different runlevel,/ETC/RC.D/RC executes the script under the corresponding directory according to the run mode specified by its parameters (run level, which you can set in the inittab file). Any kxx beginning with a stop is called by the call to the argument, and all the sxx begins with the start argument. The order of calls is performed by XX from small to large. For example, suppose the default run mode is 3,/ETC/RC.D/RC, which invokes the script under/etc/rc.d/rc3.d/as described above.
For example, the run level of entering graphics mode is 5, that is, the s start process in rc5.d runs, and the network multiuser text mode runs at 3, which is the process that runs all rc3.d s.
Single-user mode is RC1.D, if the RC0.D is the shutdown, where there is no S start, are K-Start process name, representing the killing process.
Note: The remaining operations (1) exit (2) Logout (Logout) (3) Reboot (restart) (4) shutdown (with parameters, can be shutdown--help/shutdown--?? /man Shutdown-man "manual-manual meaning" will be described in detail instructions, exit with Q), that is, the meaning of shutdown, and then you can turn off the power of the virtual machine.
(5) The general Knock Init0 will also shut down the machine.
Linux boot level
Note:the NFS Network File system, with NFS, can be networked.
configuration file
etc Directory function:
/ etc The directory is used to store the configuration files in the system, and basically all the configuration files can be found here. These files are generally named in the form of xxx.conf. By editing these files, you can change and manage your system. If/etc/xinetd.conf is a configuration file for the XINETD service,/etc/resolv.conf is used to specify the DNS server address for the native computer.
We have installed a new software. The configuration file may be stored in the/etc directory, or it may be in another directory, such as the directory where the software main program resides. Sometimes in order to facilitate management, you can set up in the/etc directory to the new software configuration file symbolic link, so no matter how the software installed, we can find its configuration file in the/etc directory.
For example: The named process profile for the DNS service named.conf generally resides in the/var/named directory, you can establish the above symbolic link with the following command:
# LN –s /var/named/named.conf /etc/named.conf
Modify the configuration of the DNS service later, as long as you edit the/etc/named.conf.
RC0.D is a directory, not a file , as follows:
-- All instructions will appear for any command on Linux that strikes 5 times ESC.
--Instructions plus --help or instructions plus --? you can give the instructions or use the man shutdown-- to tell us about the operation of shutdown.
exist exit terminal terminal, shutdown shutdown, logout logoff.
Linux system Boot Sequence