1. Backup Overview
(1) data that the Linux system needs to back up
①/root/Directory
②/home/Directory
③/var/spool/mail/Directory
④/etc/Directory
⑤ Other Directories
(2) Data for installation Services
①apache data to be backed up: Configuration files, Web page home directories, log files, etc.
②mysql the data that needs to be backed up: The source package installs the MYSQL:/USR/LOCAL/MYSQL/DATA/;RPM package installed mysql:/var/lib/mysql/
(3) Backup policy
① Full backup: full backup means all the data that needs to be backed up, and of course a full backup can back up the entire disk, the entire partition, or a specific directory.
② Incremental Backup: make a full backup for the 1th time , and then just back up the data that has been added since the last backup . This only backs up new data at a time, is faster and saves space , but recovery is cumbersome and needs to be restored in the same order as the backup, and how many incremental backups will have to be recovered.
③ differential Backup: The 1th full backup , the 2nd backup of the new data after the full backup , the 3rd backup 2nd backup and later data, 4th backup will be the 2nd backup, 3rd Backup and 3rd after the new data back up, and so on . that is, each backup is compared to a full backup, as long as the new data is backed up after a full backup . The advantage is that the recovery is easier, the more occupied space is relatively large.
2. Dump and restore commands
2.1 Dump Command :
(1) Install the dump command
grep Dump // Query the installation package where the dump command is installed #yum Install Dump // Install dump command
(2) command format:#dump [options] After the backup file name of the original file or directory
options |
Description |
-level |
10 backup levels (0-9), where 0 indicates a 1th full backup, 1 represents an incremental 2nd time backup, 2 represents an incremental 3rd backup, and so on, Span style= "COLOR: #0000ff" > supports up to 9 times . |
-f file name |
Specify file name after backup |
tr>
-u |
After the successful backup, Log the backup time in the/etc/dumpdates file |
-v |
Show more output information during backup |
-j |
Call Bzlib Library compressed file, in fact, is to compress the backup file into. bz2 format |
-w |
Query partition backup level and backup time (view only the backup status of the partition) |
(3) Application examples
① Backup/boot partition:(partitions can be fully backed up and incremental)
#dump -0uj-f/root/boot.bak.bz2/boot/ // 1th Full backup #cat /etc/dumpdates // View backup Time Files # CP install. log/boot/ Copy log file to/-1uj-f/root/boot.bak1.bz2/boot/ Incremental backup/-W Query partition backup time and backup level
② Backup directory ( directory can only be fully backed up and cannot be incrementally backed up )
#dump -0j–f/root/ect.dump.bz2/etc/Full Backup/etc directory, you can only use 0 levels for full backups, and no incremental backups are supported.
2.2 Restore Command
(1) command format:#restore [mode options] [options]
Mode options |
Description |
-C |
Compare backup data with actual data changes |
-I. |
Enter interactive mode and manually select the files to be recovered |
-T |
View mode for viewing what data is in the backup file |
-R |
Restore Mode for data restore |
Note |
The restore mode cannot be mixed. |
|
Options |
Description |
-F |
Specify file name for backup files |
(2) Application examples
① view mode:#restore-T-F boot.bak.bz2
② Restore Mode
#mkdir boot.test#cd boot.test/// Restore the backed-up data to the Boot.test directory -r-f/root /BOOT.BAK.BZ2 // restore data from a full backup // Restore an incremental backup
15th. Backup and Recovery "complete book"