78.Linux backup strategy
To back up files can usually be divided into two categories: one is the system, is similar to a class of data network services
The host system need to back up files:
/ Etc / entire directory
/ Home the entire directory
/ Var / spool / mail
/ Boot
/ Root
/ Usr / local or / opt backup at best
Network services databases:
Data set file: / etc / entire directory, / usr / local whole directory
System www + MySQL
Available on the Linux host of other database data files
Select the backup tool
Full backup tool
tar, cpio and dump a full backup is very commonly used tool, dd is also a good command. cpio biggest advantage is that "even a general device file can be copied." Make a full backup using cpio is a good choice.
Using cpio to backup and restore
# Find /-print | cpio-covB> / dev/st0 <== Backup to tape drive
# Cpio-iduv </ dev/st0
Use tar to backup and restore
# Tar - exclude / proc - exclude / mnt - exclude / tmp> zcvpf host.tgz /
# Tar-zxvf host.tgz
Use dd to back up exactly the same as the hard disk
# Dd if = / dev / hda of = / dev / hdb
Some of the basic tools Backup
Assuming the data to back up MySQL database every day, the daily data are saved as separate files, files by date to distinguish the old and new
# Tar-zpcvf mysql. `Date +% Y-% m-% d`. Tgz / var / lib / mysql
# Tar-N '2011 / 10/01 '-zpcvf home.tgz / home
Daily backup behavior
Daily data backup script