Linux operation and Maintenance Phase II (10) Start-up management
One,1, start the process:
"Load BIOS hardware information to self-test, and according to the BIOS Setup to obtain the first bootable device;
"reads every boot device. MBR, loading the BOOTLOADER(grub or Spfdisk) in the MBR;
"based on BOOTLOADER Settings Load kernel,kernel will then perform system detection, and use kernel detected hardware information, while kernel The hardware driver is loaded by loading the dynamic module;
"Kernel boot system first process /sbin/init;
"Process /sbin/init call /etc/init/rcs.conf, and then call/etc/rc.d/rc.sysinit through this configuration file , Thus the system initialization and software execution operating environment;
/etc/init/rcs.conf calls /etc/inittab, which determines the system default RunLevel, and then /etc/inittab calls /etc/ Init.rc.conf then invokes and executes the/ETC/RC.D/RC script file and passes in the run-level parameters;
/ETC/RC.D/RC confirms the incoming runlevel and runs the scripts in the corresponding RunLevel directory/etc/rc[0-6].d/ , starting and shutting down according to the prioritized priority level;
finally executes the procedure in the/etc/rc.d/rc.local, sets up the work that the system starts to run;
"If the character interface has been started, if the graphical interface calls the x-windows interface.
2,MBR is located in the hard disk 0 tracks,0 cylinders, 1 sectors, the main record BOOTLOADER boot boot and partition table, where the boot boot program accounted for 446byte, partition table for 64byte, another 2byte as the end tag, so the partition table total 64byte, each partition to occupy 16byte, only can divide 4 primary partitions.
BOOTLOADER function : The main function of loading the operating system kernel, provide a menu to choose which operating system to start, call other BOOTLOADER, which is the key to multi-system boot, note the Windows Bootloader cannot call Linux 's bootloader.
3, Common USB,SATA,SCSI and other hard drive device drivers, special file system LVM,RAID and other drivers, are stored in the form of modules in /lib/modules/ , use the Initramfs virtual file system to solve problems with the operating system installed on a SCSI hard disk or with an LVM file system.
4,#runlevel (check the operating level of the system,0: shutdown;1: Single user mode for system repair;2: Incomplete command-line mode, excluding NFS Service;3: full command-line mode, standard character interface,4: System retention, 5: Graphics mode, 6: restart
#init 0|1|2|3|5|6 (switching system runlevel
5,grub: Support more file system;Grub 's main program can find kernel files directly in the file system; The system starts with the Grub interface to edit and modify the startup options; dynamic modification Grub configuration file, restart is effective without reinstalling grub.
The main program of GRUB is implemented in three stages:
Stage1: Execute Main Program (main program is located in bootloader) to start stage1.5 and stage2;
stage1.5: Identify different file system, it is located in the 32K space after the MBR , this piece of hard disk space is blank useless, and there is no file system, so stage1 can read directly stage1.5, which can identify the impossible file system;
Stage2: Loads The Grub configuration file (/boot/grub/grub.conf), and then loads kernel and Initramfsbased on the definitions in the configuration file , then kernel takes over the boot process and continues the self-test loading of the hardware module.
"System does not have grub, manual installation steps:
#grub-install--ROOT-DIRECTORY=/TDISK/DEV/SDB1
#vi/boot/grub/gurb.conf
Title CentOS Tdisk
Root (hd1,0)
Chainloader +1 (Start the system using the boot sector of the current partition )
#grub
Grub>root (hd0,0) (set grub 's home directory, this can only be (hd0,0) , because the kernel and file system are installed in /dev/sda1
Grub>find/boot/grub/stage1
Grub>find/grub/stage1
Grub>find vmlinuz-2.6.32-279.3l6.i686
Grub>set (hd1,0) ( install grub in the boot sector of the Tdisk partition
Grub>quit
Note:#grub-install option device file name
--root-directory=dir (DIR is the actual directory, manually specify the installation directory for Grub-related files
" Grub in MBR is overwritten and grub needs to be reinstalled
Disc Repair mode:
Sh-4.1#grub
Grub>root (hd0,0)
Grub>setup (hd0,0)
Grub>quit
"Grub Encryption
#grub-md5-crypt (two-pass password generation encryption string
#vi/boot/grub/grub.conf
Timeout=5
Password--md5 Place an encrypted string here (You must place the encrypted string between timeout and splashimage, which takes effect only when you start editing grub on boot , there is a normal start to enter the system
Splashimage= ...
Title CentOS (2.6...)
Lock ( the next line in the title field locks the lock, you must enter the correct password to start normally. )
Third, kernel module management
Kernel module Save location:/lib/modules/$ (uname-r)/kernel/
The Depmod command scans all kernel modules in the system and then puts the results into the MODULES.DEP file, and subsequent module installations and deletions depend on the contents of the file, such as the absolute path where the module is located, and the module's dependencies.
#depmod-a|-a|-n
-A scan all modules
-A scans for new modules before updating MODULES.DEP
-N output to screen only, not write MODULES.DEP
#lsmod (kernel module View
#modprobe option module name
-L List all modules
-F Force load module
-R Delete module
Example:#depmod-A
#modprobe VFAT
#lsmod |grep VFAT
#modprobe-R VFAT
Four, system Repair mode:
1, single-user mode: Forgotten root password, modify the system default operating level.
2, disc Repair mode: Multi-system coexistence,grub is overwritten; important system files are missing, causing the system to fail to boot.
#chroot/mnt/sysimage (the default root directory in disc mode is the emulated root of the disc, and the system root is placed as a foreign device in the/mnt/sysimage
From Brother Lian Training
This article is from the "Linux Operational Difficulty Learning notes" blog, please be sure to keep this source http://jowin.blog.51cto.com/10090021/1651809
Linux Operations Phase II (10) Start management