Basic Linux Learning 7

Source: Internet
Author: User
Tags prepare rsync

Linux Start-up process Analysis1. Load the hardware information of the BIOS and conduct self-test, and obtain the first bootable device according to the setting; 2. Read and execute the boot Loader (i.e. grub, spfdisk, etc.) of the MBR in the first boot device; 3. Based on the boot loader settings to load the Kernel, Kernel will start to detect hardware and load drivers; 4. After the hardware driver succeeds, Kernel will actively call the INIT program, and INIT will get run-level information; 5. Init executes the/etc/rc.d/rc.sysinit file to prepare the operating environment for the software execution (e.g. network, time zone, etc.); 6. Init performs the start of each service of the Run-level (script side test); 7. Init executes/etc/rc.d/rc.local archives; 8. Init executes the terminal emulator Mingetty to start the login program, and finally waits for the user to log in, namely: BIOS self-test and hardware detection--"bootloader load kernel self-test and hardware detection-" Kernel call init-"Init call Rc.sysinit System Initialization-"INIT call service initialization-" Init call rc.local Local User settings initialization-"Enter the login program BIOS (Basic Input Output System) BIOS is through the hardware INT13 Interrupt function to read the MBR; where is the Boot Loader program installed? In the first sector of the boot unit (sector), which is what we have been talking about MBR (master boot record, the main boot record area).  /sbin/init /etc/inittab and runlevel the first program init and configuration file/sbin/init The main function is to prepare the software execution environment, including the system hostname, network settings, language processing, File system format and other services start-up and so on. And all of the actions will be through the init configuration file, that is,/etc/inittab to plan, and Inittab also has a very important setting project, that is the default runlevel (boot execution level); The  run level is divided into 7 levels:? 0-halt (System direct shutdown)? 1-single user mode (single-player maintenance mode, for maintenance in case of system problems)? 2-multi-user,Without NFS (similar to the bottom of runlevel 3, but no NFS service)? 3-full Multi-User mode (full web-enabled plain text mode)? 4-unused (System hold function)? 5-x11 (similar to RunLevel 3, but loaded using X Window)? 6-reboot (restart)   /etc/inittab's content and syntax The syntax of the file is to use a colon (:) Separating the settings into four fields, the meanings and descriptions of each field are as follows: [Set project]:[run level]:[init action behavior]:[Directive Project] 1. Set item: Up to four characters, representing Init's main work item, is simply a description of the representative. 2. Run level: What is the meaning of the project under Run level? If it is 35 then the RunLevel 3 and 5 will be executed. 3. Init's action item: the main possible action item meaning is: 4. Directive items: That is, instructions that should be available, usually some script.  /etc/rc.d/rc.local user-defined boot program   make  confing process    dynamic and static function library static (static) features: extension:                 (with the extension. A) This type of Vault library typically has a LIBXXX.A-typed compilation behavior:   Such a vault is integrated directly into the execution program when it is compiled , so the files compiled by the static Taipa library will be larger; the state of the standalone execution:   The biggest advantage of this type of vault library is that the successful executable can be executed independently without the need to read the contents of the Taipa library to external requirements. Ease of upgrade:   Although the execution file can be executed independently, but because the Taipa library is directly integrated into the execution file, if the Cotai Library is upgraded, the entire execution file must be recompiled in order to integrate the new version of the Taipa library into the program.                               that is to say, in terms of upgrade, as long as the Cotai Library Level, all the programs that incorporate this Taipa library need to be recompiled!   Dynamic Features: extension:                     (with the extension. So) These types of Taipa libraries typically have extensions named libxxx.so; compile behavior:           &nbsp The compilation behavior of the   dynamic Taipa Library and the static Taipa library is quite different. With the static Taipa library is the entire catch to the program, the dynamic Taipa library at compile time, in the program there is only a "point                 The       and nbsp                 (Pointer) "location. That is, the content of the dynamic Taipa Library is not integrated into the execution file, but rather when the execution of the file to use the mechanism of the Taipa library, the program will read the Taipa library to make                 the                , because the execution file only has pointers to the dynamic Taipa Library, does not include the contents of the Taipa library, so the file size is smaller; the state of independent execution: This type of Taipa library is compiled Out of the program cannot be executed independently, because when we use the mechanism of the Taipa library, the program will read the Taipa library, so the Vault archive "must exist" only,               the   &nbsp ;               Also, the "Directory of the Taipa library cannot be changed" because the only "pointer" in our executable is that when the dynamic Cotai Library is to be fetched, the program actively goes to a path to read. So move                                 state-of-the-gallery Can move or delete, will affect a lot of dependent program upgrade difficulty: Although this type of execution file can not be operated independently, however, because it has the function of pointing, so, when the Cotai Library upgrade, the execution file does not need to recompile the behavior, because the execution file will refer directly to                                 to the new Vault archive (provided the old and new versions of the Taipa library have the same filename!) )。  RPM  installation [[email protected] ~]# RPM-IVH package_name
Options and Parameters:
-i:install meaning-V: View a more detailed installation Info screen-H: Displays the installation progress in the installation information column
Example one: Install rp-pppoe-3.5-32.1~]# rpm-ivh rp-pppoe-3.5-32.1. I386.rpmpreparing ####################################### [%]1: Rp-pppoe # # # #################################### [%]

~]# RPM-IVH http://website.name/path/pkgname.rpm
RPM Upgrade and update (Upgrade/freshen)-UVH after the software, even if not installed, the system will be installed directly, if the following software has been installed older version, the system automatically updated to the new version;-FVH If the next software is not installed on your Linux system, The software will not be installed, i.e. only software that has been installed in your Linux system is "upgraded"! RPM lookup (query) [email protected] ~]# RPM-QA <== installed software
[[email protected] ~]# RPM-Q[LICDR] installed software name <== installed software
[[email protected] ~]# RPM-QF exists to a file name above the system <== installed software
[[email protected] ~]# RPM-QP[LICDR] A file name not installed <== view RPM profile
Options and Parameters:
To query information about installed software:
-Q: Only query, followed by the software name is installed;-QA: Lists all the software names that have been installed on the native Linux system,-qi: Lists the details of the software (information), including the developer, version, etc.-ql : Lists the full file name (list) of all the files and directories of the software;-QC: Lists all the configuration files for the software (find out the files under/etc/)-QD: List all the documentation for the software (find the files that are not man-related)-QR    : List all files associated with the software (Required) use Yum to query, install, upgrade and remove features [[email protected] ~]# yum [option] [Query work items] [related parameters] options and Parameters:-y:  This option automatically provides a yes response when Yum waits for user input,--installroot=/some/path: Installs the software in/some/path instead of using the default path [querying work items] [related parameters]: Here are the parameters: search: Search for a software name or a description (description) Important keywords; info: ditto, but somewhat similar to Rpm-qai's execution; provides: search for software from the file!  Similar to RPM-QF features! [email protected] ~]# yum [option] [Query work items] [related parameters]
Options and Parameters:
Install: Follow the software to be installed! Update: After the software to upgrade, to upgrade the entire system, the direct update can be-qremove: Remove the software from the back; Backup Policy 1. System Basic Settings Information? /etc/Entire Directory
? /Home Entire Directory
? /var/spool/mail
? /boot? /root? If you have installed other packages yourself, then/usr/local/or/opt also better back up! 2. Network Service data Information? The software itself configuration file case, for example:/etc/the entire directory,/usr/local/the entire directory? Software services to provide data to WWW and MySQL for example: www:/var/www entire directory or/srv/www entire directory, and the user home directory of the system MySQL:/var/lib/mysql the entire directory? Database files for other services provided on Linux hosts! Due to hardware or cost limitations, bird's recommendation needs to be backed up directory:? /boot
? /etc
? /home
? /root
? /usr/local (or/opt and/srv, etc.)? /VAR (note: Some of the staging directories in this directory may not be backed up!) ) Backup storage media selection 1. Hardware backup, such as hard disk, CD, etc. 2. Offsite redundancy system that regularly backs up data to offsite machines   types, frequencies, and tools for backup:Accumulate backup and differential backups full backup of the cumulative backup (Incremental Backup) If your host is responsible for a very important service, then when the system is damaged, you want to restore the system in the shortest time possible, just back up the critical data, because only the key data,                                                           Also need to reinstall new Disturbtion, but also consider the difference between the old and new version of the problem, but also to carry out data migration and system service reconstruction; So a full backup is required; accumulate backups: Cumulative backup operation intention is only compared to the previous cumulative result, the backup and the previous cumulative difference; the backup software used by the cumulative backup DD, Cpio, dump/restore# 1. Use DD to back up the/DEV/SDA to a completely identical/dev/sdb hard drive: [[email protected] ~]# DD IF=/DEV/SDA of=/dev/sdb# since DD is a read sector,/DEV/SDB this disk can No formatting required! It's very convenient! # Just you'll wait very, very long! Because DD speed is slow! # 2. Use Cpio to back up the entire system without restoring, assuming the storage media is a SATA tape drive: [[email protected] ~]# Find/-print | Cpio-covb >/dev/st0 <== Backup to tape drive [[email protected] ~]# Cpio-iduv </dev/st0 <== Restore assume that/home is a separate file system and/backu Pdata is also a standalone file system for backup, so how do I use dump to make a full backup of/home to/backupdata? Can look like this: # 1. Full backup
[Email protected] ~]# dump-0u-f/backupdata/home.dump/home# 2. Cumulative backup for the first time [[email protected] ~]# dump-1u-f/backupdata/home.dump.1/home differential backup: A differential backup is a bit similar to a cumulative backup and is required for the first full backup to be performed. Just a differential backup refers to the result that each backup is compared to the original full backup. So the longer the system works, the longer it takes to complete the backup, the larger the differential backup data can be! The differential backup is as follows: Differential backup the tools you use most often are similar to cumulative backups! Because they all need a full backup! If you use dump to back up, then the level of each backup will be 1 meaning! Of course, you can also use the TAR-n option to back it up! as follows: [[email protected] ~]# tar-n ' 2009-06-01 '-jpcv-f/backupdata/home.tar.bz2/home# only in a new file than in 2009-06-01, under/home The files will be packed into the home.bz2! What's strange is that the directory will still be recorded, but the old files in the directory will not be backed up. In addition, you can also use rsync to perform a mirrored backup. This rsync can mirror two directories (mirror), a very fast backup tool! The simple instruction method is: [[email protected] ~]# rsync-av source Directory destination Directory
# 1. Mirror the/home/to the/backupdata/home/.
[Email protected] ~]# rsync-av/home/backupdata/
# At this time, the home directory will be produced under the/backupdata! [[email protected] ~]# rsync-av/home/backupdata/# will be much faster! If the data is not changed, almost nothing will be done!

Basic Linux Learning 7

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.