[Linux management] Linux system boot and boot, management of linux system boot

Source: Internet
Author: User
Tags stop script tmp file

[Linux management] Linux system boot and boot, management of linux system boot
**************************************** ********************************* *** Original article: blog.csdn.net/clark_xu Xu changliang's column**************************************** ********************************1 linux system startup and boot

The linux Startup Process is: The computer executes the BIOS code, confirms loading and starting the kernel, checks the hardware of the system, and generates the system init process. This process is always PID 1; the system must check and install the file system, and the system Daemon must be started. The init process runs a series of rc (run commond) file scripts in sequence.

In summary, a typical linux boot process consists of six different stages.

L load and initialize the kernel

L check the configuration Device

L create a kernel thread

L operator intervention

L execute the system startup script

L multi-user mode

Initialize the kernel: the path name is usually/boot/vmlinux. In the first stage, the system rom loads a small boot program into the memory, and the program is arranging to load the kernel. The kernel checks how much RAM is available, and the kernel occupies a portion of static Space (the user process is unavailable). Then the kernel prints information, the total physical memory and the amount of memory available for the user process.

Configure hardware: the BIOS tells the kernel which hardware devices are available. The kernel needs to locate the hardware device and initialize each device. If no driver is detected, the driver is disabled;

Kernel thread: the kernel creates the init process in the user space.

Operator intervention: in a single user environment, the root directory of the file system is installed in read-only mode. /Tmp is a part of the root directory. The command of the tmp file must be used, for example, (vi) cannot be executed. You can mount-o rw and remount/to re-install the root directory in read/write mode.

Run the Startup Script: The init selects to run the rc Script based on certain algorithms.

Multi-user running: init directly produces the getty process to monitor the terminal and console for user logon. Init has the running level of a single user and multiple users, and determines which resources to start.

BOIS loading: BIOS select boot device (IDE hard disk, CD-ROM, etc.), selected device read MBR (Hard Disk Head 512 bytes information: master boot record master boot records ). The MBR program tells the CPU to load the boot loader from the hard disk partition ). Then boot loader loads the kernel.

1.1 boot loader

Lilo is a traditional linux boot loader (used in debian). grub (grand unified boot loader) becomes the default boot loader for redhat, suse, and fedora.

The name of the grub device (hd0, 0) is equivalent to linux/dev/hda1.

The user installs grub on the boot drive/dev/hda1.

Grub-install' (hd0, 0) '# use quotation marks to avoid shell parsing parentheses

By default, grub reads its default boot configuration from/boot/grub. conf.

If grup within 10 s (timeout = 10) does not accept the input of the incoming keyboard, it will be automatically guided (default = 0 ),

Default Configuration

Default = 0

Timeout-10

Titile redhat linux

Root (hd0, 0)

Kernel/boot/vmlinux ro root =/dev/hda1

 

Root: Specify the root device (one partition)

Boot: Start the system with a specific kernel Image File

1.1.1 lilo: Traditional linux boot loader

The lilo command installs the configuration information through the content of/etc/lilo. conf. Run lilo again

Boot =/dev/hda boot loader on MBR

Root =/dev/hda1

Delay = 20 2 seconds

Image =/vmlinz Kernel

Lable = linux

Read-only

Image =/vmlinuz-backup Kernel

Lable = backup

Read-only

1.1.2 multi-boot configuration of grub

First install the operating system and then modify/boot/grub. conf accordingly.

Boot windows grub. conf configuration

Title windows xp

Rootnoverify (hd0, 0)

Chainloader + 1

The chainloader option loads the Boot Loader from a specified location (pilot from the first IDE partition)

The rootnoverify option ensures that grub does not try the specified partition. For example, guide three partitions:

Hiddenmenu

Title windows xp

Rootnoverify (hd0, 0)

Chainloader + 1

Title red hat

Root (hd0, 1)

Kernel/boot/vmlinuz

Title fedora

Root (hd0, 2)

Kenrel/boot/vmlinuz

1.2 Startup Script

The traditional init defines seven run-level run levels. level 0 indicates that the system is completely shut down; level 1 indicates the single-user mode; level 2 indicates the multi-user level; level 6 indicates reboot) level

/Etc/initab specifies the initab command to run (or keep running) when the system enters every level to call the command in/etc/init. d/rc to change the running level. Initab main script to find rc0.d, rc1.d, rc2.d... To run scripts.

When a script starts from low to high, it is executed in ascending order starting with S, with the start parameter

Ln-s/etc/init. d/cups/etc/rc2.d/s80cups

When the transition from high to low, the numbers starting with K decrease, with the stop script

Ln-s/etc/init. d/cups/etc/rc0.d/k880cups

1.2.1 start service configuration

During Service Startup, most configurations in the redhat boot process are completed by operating the configuration file in/etc/sysconfig.

/Etc/sysconfig subdirectory

L clock: Specifies the clock type.

L https: determines the apache processing mode.

L hwconfg: hardware information

L i18n: local configuration of the Operating System: Date Format, language, etc.

L init: configure the Message Display Mode of the Startup Script

L network: global network parameters: Host Name, gateway, and forwarding mechanism

1.3 reboot and Shutdown

Shutdown in 15 minutes

Shutdown-h + 15 "going down for emergency disk repar"

Shutdown at half past nine A.M.

Shutdown-h "going down for expected downtime is 1 hour"

Change the init running level

Telinit 1

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.