15th talk about start-up management the.1Centos6. x Start Management//refer to 6.3 here15.1.1system Run Level1operating level runlevel meaning0turn off the machine1Single-user mode, which can be imagined as a safe mode for Windows, primarily for system repair//Linux has a different security model2Incomplete command-line mode with no NFS service//file sharing between Nfs,linux3Full command-line mode, which is the standard character interface//is what we're currently using.4System Retention5Graphics Mode6Restart2, run level command [[email protected]~]# runlevel #查看运行级别命令//N 3, represents the boot directly into 3. Two data represents the previous and current levels[[Email protected] ~]# init run level #改变运行级别命令3, system default operating level [[email protected]~]# vim/etc/inittab ID:3: Initdefault: #系统开机后直接进入哪个运行级别//What the init process is doing15.1.2system startup process start Flowchart//The arrow in the picture is wrong, too easy to cause confusion, is very simple direct diagram. Initramfs memory file system? CentOS6. x uses the Initramfs memory file system instead of the CentOS5the INITRD RAM Disk in. x. They work similarly, can be loaded into memory by booting the bootloader, and then load the kernel modules needed during the boot process, such as USB, SATA, SCSI hard drive and LVM, RAID file system driver mkdir/tmp/INITRAMFS #建立测试目录 CP/boot/initramfs-2.6. +-279. el6.i686.img/tmp/initramfs/#复制initramfs文件 CD/tmp/initramfs/file Initramfs-2.6. +-279. el6.i686.img MV Initramfs-2.6. +-279. el6.i686.img initramfs-2.6. +-279. el6.i686.img.gz #修改文件的后缀名为. GZ gunzip Initramfs-2.6. +-279. el6.i686.img.gz #解压缩 file Initramfs-2.6. +-279. el6.i686.img Cpio-IVCDU < initramfs-2.6. +-279. el6.i686.img #解压缩调用/etc/init/rcs.conf configuration file? The main function is two:? Call first/etc/rc.d/rc.sysinit, and then by/etc/rc.d/rc.sysinit configuration file for Linux system initialization.? then call/etc/inittab, and then by/etc/The Inittab configuration file determines the default operating level of the system. by/etc/rc.d/Rc.sysinit Initialization1, access to the network environment2, Mount device3, boot screen Plymouth (replace the past RHGB)4, determine if SELinux is enabled5, display the Welcome screen in the boot process6, initializing hardware7, user-defined module loading8, configuring the kernel parameters9, set host nameTen, synchronous memory One, device Mapper, and associated initialization A, initializing the software disk array (RAID) -, initialize the file system function of LVM -, verifying Disk File System (FSCK) the, set disk quotas (quota) -, re-mount the system disk in read-write mode -, update quota (not necessary) -, start the system virtual random number generator +, configuring the machine (not necessary) -, clear the temporary files during boot +, create an ice directory A, start swap partition (swap) at, write the boot information to/var/log/called in the DMESG file/etc/rc.d/RC file? Run-level parameters passed inAfter/ETC/RC.D/RC this script, it is started by this script file at different runlevel/etc/rc[0-6].d/The corresponding program in the directory?/etc/rc3.d/k?? The beginning of the file (??is a number), and then turn it off in numerical order?/etc/rc3.d/s?? The beginning of the file (??numbers), which are sequentially started in numerical order the.2Boot loader-Grub15.2.1Grub Configuration File1, grub in partition indicates hard disk partition in Linux device file name grub in device file name first SCSI hard disk first primary partition/DEV/SDA1 HD (0,0) The second primary partition/dev/sda2 HD (0,1) Extended partition/dev/sda3 HD (0,2) The first logical partition/DEV/SDA5 HD (0,4The first primary partition of the second SCSI hard disk/DEV/SDB1 HD (1,0) The second primary partition/DEV/SDB2 HD (1,1) Extended partition/DEV/SDB3 HD (1,2) First Logic/DEV/SDB5 HD (1,4) 2, GRUB configuration file vi/boot/grub/grub.conf?default=0start the first system by default? Timeout=5wait time, default is 5 seconds? Splashimage= (hd0,0)/grub/splash.xpm.gz Here is the location where the background image file is specified when grub starts? hiddenmenu hidden menu? title CentOS (2.6. +-279. el6.i686) title is the meaning of the headline? Root (hd0,0) refers to the save partition of the startup program? Kernel/vmlinuz-2.6. +-279. el6.i686 ro root=uuid=b9a7a1a8-767f-4a87-8a2b-a535edb362c9 rd_no_luks keyboardtype=pc KEYTABLE=us Rd_NO_MD Crashkernel=auto LANG=ZH_CN. utf-8RD_NO_LVM rd_no_dm rhgb Quiet Define the options when the kernel loads? INITRD/initramfs-2.6. +-279. EL6.I686.IMG specifies the location of the Initramfs memory file system image file15.2.2Grub Encryption and character interface resolution adjustment1, grub encryption [[email protected]~]# grub-md5-crypt #生成加密密码串 [[email protected]~]# vi/boot/grub/grub.confdefault=0Timeout=5Password--MD5 $1$Y 84lb1$8tmy2pibscmuocc8z8u35/#password选项放在整体设置处. Splashimage= (hd0,0)/grub/splash.xpm.gz Hiddenmenu ... Omit part of the content ...2, pure character Interface resolution adjustment grep"Config_framebuffer_console"/boot/config-2.6. +-279. el6.i686 #查询内核是否支持分辨率修改色深640X480 -X - 1024x768X768 theX1024x7688 Guests769 771 773 77515 Guests784 787 790 79316 Guests785 788 791 79432 Guests786 789 792 795VI/boot/grub/grub.conf Kernel/vmlinuz-2.6. +-279. el6.i686 ro root=uuid=b9a7a1a8-767f-4a87-8a2b-a535edb362c9 rd_no_luks keyboardtype=pc KEYTABLE=us Rd_NO_MD Crashkernel=auto LANG=ZH_CN. utf-8RD_NO_LVM rd_no_dm RHGB Quiet vga=791 the. 3 System Repair Mode//2 did not look seriously, later when used to see again1, single user mode single user mode common bug fixes? Forgot root password? Modify the system default run level2, disc Repair mode important system files are missing, which prevents the system from starting bash-4.1# chroot/mnt/sysimage #改变主目录 Sh-4.1# CD/Root sh-4.1# rpm-qf/etc/Inittab #查询下/etc/which package the Inittab file belongs to. SH-4.1# mkdir/mnt/cdrom #建立挂载点 sh-4.1# mount/dev/sr0/mnt/CDROM #挂载光盘sh-4.1# rpm2cpio \/mnt/cdrom/packages/initscripts-8.45.3-1. i386.rpm \| Cpio-idv./etc/inittab #提取inittab文件到当前目录 Sh-4.1# CP etc/inittab/etc/Inittab #复制inittab文件到指定位置3, Linux Security
16th Talk about backup and recovery16.1Backup Overview1, what data does the Linux system need to back up?/root/directory:?/home/directory://For example, the file server will need to back up this target?/var/spool/mail/directory:?/etc/directory:? Other directories: If/var/log/Install the data for the service? What data does Apache need to back up? configuration file? Web page home directory? Log files? MySQL needs to be backed up? Source package installed MySQL:/usr/local/mysql/data/ ? RPM package installed by MySQL:/var/lib/mysql/2, backup strategy? Full backup: Full backup means all the data that needs to be backed up, of course, full backup can back up the entire hard disk, the entire partition or a specific directory incremental backup differential backup16.2dump and Restore commands//don't want to hear it, see it when you need it1, dump command [[email protected]~]# Dump [option] File name original file or directory option after backup:-level: That's what we're talking about. 0-90 levels of backup-f file Name: Specify the file name after the backup-U: After the backup is successful, log the backup time to/etc/dumpdates File-V: Displays more output information during the backup process-J: Call Bzlib Library Compressed backup file, in fact, is to compress the backup file into. bz2 format, the default compression level is 2-W: Displays the backup level of the partition that is allowed to be dump and backup time backup partition dump-0uj-f/root/boot.bak.bz2/boot/#备份命令. Perform a full backup first, and compress and update the backup time cat/etc/dumpdates #查看备份时间文件 CP Install.log/boot/#复制日志文件到/boot partition Dump-1uj-f/root/boot.bak1.bz2/boot/#增量备份/boot partition, and compress dump–w #查询分区的备份时间及备份级别的备份文件或目录 dump-0j-f/root/etc.dump.bz2/etc/#完全备份/etc/directory, can only use 0 levels for full backups, and no longer supports incremental backups2, restore command [[email protected]~]# Restore [mode options] [options] mode options: The RESTORE command has the following four modes, which cannot be mixed in four modes. -C: Compare the changes in backup data and actual data-I: Enter interactive mode, manually select the files that need to be recovered. -T: view mode for viewing what data is in the backup file. -r: Restore Mode for data restore. Options:-F: Specify the file name of the backup files compare the changes in backup data and actual data MV/boot/vmlinuz-2.6. +-279. el6.i686/boot/vmlinuz-2.6. +-279. El6.i686.bak//Be sure to remember to change back, or the next time can not start normally#把/kernel image file in boot directory change the name of restore-c-f/root/boot.bak.bz2 #restore发现内核镜像文件丢失查看模式 Restore-T-F boot.bak.bz2 Restore Mode #还原boot. BAK.BZ2 partition backup #先还原完全备份的数据 mkdir boot.test CD boot.test/Restore-r-f/root/boot.bak.bz2 #解压缩 Restore-r-f/root/boot.bak1.bz2 #恢复增量备份数据 # Restore/etc/Backup of directory etc.dump.bz2 restore-R-f etc.dump.bz2 #还原etc. dump.bz2 Backup
Linux Learning 15 16 start management, backup and recovery