Linux Management Linux system boot and boot

Source: Internet
Author: User

************************************************************************* * * * Original:blog.csdn.net/clark_xu Xu Changliang's Column************************************************************************1 LinuxSystem Boot and Boot

The Linux startup process is: The computer executes the BIOS code, confirms that the kernel is loaded and booted, the kernel detects the system's hardware, and generates the system's init process, which is always PID 1 The system must check and install the file system, and the daemon of the system must be started, these steps run a series of RC(run commond) file scripts in sequence by the init process

in summary, the typicallinux boot process consists of 6 different stages.

l Load and initialize the kernel

l Check the configuration device.

l create kernel thread

l operator Intervention

l Execute system startup script

l Multi-user mode operation

Initialize kernel: The path name is usually /boot/vmlinux, in the first stage, the system ROM loads a small bootloader into memory, and the program is then scheduled to load into the kernel. Kernel execution detects how much RAM is available, the kernel consumes a portion of the static space (the user process is not available), and then the kernel prints information, the total amount of physical memory, and the number of user processes available.

Configure hardware: TheBIOS tells the kernel which hardware devices the kernel needs to locate the hardware device and initialize each device. Drivers that are not detected by the device are disabled;

kernel Thread: The kernel creates the init process in user space.

operator Intervention: In a single user environment, the root directory of the file system is installed in read-only mode. / tmp is part of the root directory and commands that require the tmp file, such as (VI), cannot be executed. You can do this mount–o rw,remount/ to reinstall the root directory as read-write.

Execute startup script: by init select Run RC script according to certain algorithm

Multi-user Run : init directly produces the Getty Process to monitor the terminal and console to accept user logins. Init has a single-user and multi-user run level that determines which resources to start.

BOIS Load:BIOS Select Boot device (IDE hard disk,CD-ROM , etc.), the selected device reads MBR(hard disk header byte information: master boot record). The MBR program tells the CPU to load the boot loader from the first few hard disk partitions (bootloader). After boot loader loads the kernel.

1.1 Boot loaderBoot loader

Lilo is the traditional Linux boot loader (Debian use), andGrub(Grand Unified boot loader) becomes R Edhat, the default boot loader for SuSE and Fedora .

Grub Device naming (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/grub.conf .

if grup within 10s (timeout=10) does not accept incoming keyboard input, then automatically boot (default=0),

Default configuration

Default=0

Timeout-10

Titile Redhat Linux

Root (hd0,0)

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

Root : make a root device (a partition)

Boot: booting the system with a specific kernel image file

1.1.1 Lilo:TraditionalLinuxBoot loader

The Lilo command installs configuration information through /etc/lilo.conf content. Re-run Lilo

Boot=/dev/hda will boot loader on MBR

Root=/dev/hda1

delay=20 2 seconds

Image=/vmlinz Kernel

Lable=linux

Read-only

image=/vmlinuz-backup Backup kernel

Lable=backup

Read-only

1.1.2 GrubMulti-Boot configuration

Install the operating system first and then modify the /boot/grub/grub.conf accordingly.

grub.conf configuration for booting Windows

Title Windows XP

Rootnoverify (hd0,0)

Chainloader +1

chainloader This option loads the boot loader from a specified location (booting from the first IDE partition)

The rootnoverify option ensures that Grub does not attempt to specify the partition. such as booting 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.2Startup scripts

the traditional init defines 7 runlevel run levels , Level 0 is the level of completely shutting down the system, and level1 represents single user mode;2-5 represents multi-user level ; level6 is a reboot (reboot) level

/etc/initab Specifies that the command to run (or keep running) when the system enters each level initab call /etc/init.d/rc inside the command to change the run level. initab main script Find rc0.d,rc1.d,rc2.d ... Directory to run the level of the script.

when starting from low-to-high-level scripts, execute in increments of S , with the start parameter

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

when transitioning from a high-to-low level, decrements by the number of K , with the stop script

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

1.2.1Start Service configuration 

During the service startup process, most of the configuration of theredhat boot process is done by manipulating the configuration files in the /etc/sysconfig .

Sub-directories for /etc/sysconfig

l Clock : Specify the clocking type

l https: determines the processing mode of Apache

l hwconfg: Hardware information

l i18n: The local configuration of the operating system: Date format, language, etc.

l init: Configure how the startup script messages are displayed

l Network : Global Networking parameters: hostname, gateway, forwarding mechanism

1.3Rebooting and shutting down the machine

shutdown after minutes

Shutdown–h +15 "Going down for emergency disk Repar"

Morning 9 -point half-off

Shutdown–h 09:30 "Going down for expected downtime are 1 hour"

Change the runlevel of init

Telinit 1

Linux Management Linux system boot and boot

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.