Linux Operations Phase II (14) Backup and recovery

Source: Internet
Author: User

Linux operation and Maintenance Phase II (14) Backup and recovery

One, 1,Linux system Important data:/root/,/home/,/etc/,/var/spool/mail/,/boot/,/var/lib/mysql

Apache Backup data:/etc/httpd/conf/httpd.conf,/var/www/html/,/varlog/httpd, the above rpm Package installation method of important data; /usr/local/apache2/conf/httpd.conf,/usr/local/apache2/htdocs/,/usr/local/apache2, the above is the source package installed Apache Important data.

MySQL backup data:/var/lib/mysql,rpm Package database contents;/usr/local/mysql/data/ Source package database contents.

2. Backup policy:

"Full backup: Recover data fast, the key server full disk backup, set up another identical server;

Incremental backup: Excellent: Less backup data, less time consuming, less space; lack: data recovery trouble. Process: A full backup is performed first, and only the differential data is backed up compared to a full backup, and the second time compared to the first incremental backup, only the differential data is backed up, the third time compared to the second incremental backup, and so on.

Differential backup: Neither backs up all of the data like a full backup, nor is it as cumbersome as incremental backup data recovery: As time increases, data changes more and more, takes up space, and backups are slow. Process: A full backup is performed first, and each subsequent differential backup is compared to the full backup data, recovering the data from the full backup before recovering the differential backup.

second, the "#dump option after the backup file name source files or directories

-[0-9] 0 refers to a full backup,1-9 to an incremental backup level. Note: The 1-9 incremental backup level is supported only if you are backing up the entire partition or the entire hard drive, and only if you are backing up files or directories with level 0.

-F file name after backup

-U The backup time is recorded in the/etc/dumpdates file after successful backup , backup file or directory cannot use this option

-V Verbose

-j call bzlib Library to compress the backup file in the format bz2, the default compression level is 2

-W display partition backup level and backup time allowed to be dump

Note:dump differential backup uses a 0 level full backup first, with 1 levels for each subsequent backup.

Example:#dump -0uj-f/root/boot.bak.bz2/boot

#cat/etc/dumpdates

#dump -1uj-f/root/boot/bak1.bz2/boot (if the data changes, use an incremental backup of level 1, if subsequent data changes, you can continue to use 2-9-level incremental backup

#dump-W (If the-u option is not written when backing up , this command does not display

Example:#dump -0j-f/root/etc/bak.dump.bz2/etc/ (files or directories can only use level 0

"#restore mode options

-C Comparison of backup data and actual data changes, if the actual data changes in the existing data,-C can be detected, if the actual data in the new data,-C can not detect changes

-I. Interactive

-T view mode

-R Restore

option -F followed by backup file name

Example:#touch/boot/abc

#restore-C-f/root/boot/bak.bz2(not detected

#mv/boot/vmlinuz... Img/boot/vmlinuz..... Img.bak

#restore-C-f/root/boot.bak.bz2 (can detect changes

Example:#restore-T-f/root/boot.bak.bz2

#restore-R-f/root/boot.bak.bz2 (create a test directory before recovery, otherwise it will be restored directly to the source directory

#restore-R-f/root/boot.bak1.bz2 (restores the data for incremental backups

Third, Backup tool: DD

#dd if= input file of= output file bs= number of data block count=

If (the file that defines the input data, it can also be an input device

of (the file that defines the output data, can also be an output device

BS (defines the size of a data block, the number of bytes read or written by a cool, default 512byte

Count (Specify the number of BS

Example:#dd if=/etc/httpd/conf/httpd.conf of=/tmp/httpd.bak (backup file

Example:#dd if=/dev/sda1 of=/tmp/boot.bak (partition backup as file

#dd If=/tmp/boot.bak of=/dev/sda1 (Recovery

Example:#dd if=/dev/sda1 of=/dev/sdb1 (partition backup to another partition

#dd if=/dev/sdb1 of=/dev/sda1 (Recovery

Example:#dd if=/dev/sda of=/dev/sdb (full disk backup

#dd IF=/DEV/SDA of=/tmp/disk.bak (disk backup as file

Example:#dd if=/dev/cdrom of=/tmp/cd.iso (make disc ISO image

#mkdir/MNT/CD

#mount-O LOOP/TMP/CD.ISO/MNT/CD

Example:#dd if=/dev/zero of=/tmp/testfile bs=1m count=10 (making a file of the specified size

Note:DD in the full disk copy, similar to the Ghost tool,dd Copy the hard drive data is much more stable than ghost , the shortcomings take a long time.

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/1651998

Linux Operations Phase II (14) Backup and recovery

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.