Linux system backup

Source: Internet
Author: User
Tags gz file

Linux system backup =========================================================== Author: gswwgph (http://gswwgph.itpub.net)
Comment posted: 2006.06.15 17:39
Category: Unix operating systems
Source: http://gswwgph.itpub.net/post/13860/114636
What are the factors that---------------------------------------------------------------Linux to consider when backing up?

Which files to back up:
For example, in the account management of the article, we know that the minimum Host account information in/etc/* and/home/* and so on files are important!

What backup media to choose:
Is it a rewritable disc, another hard drive, a different partition on the same drive, or a network redundancy system? Which kind of speed is the most
Fast, cheapest, can save data for the longest time?

What are some of the factors that Linux considers when backing up?

Which files to back up:
For example, in the account management of the article, we know that the minimum Host account information in/etc/* and/home/* and so on files are important!

What backup media to choose:
Is it a rewritable disc, another hard drive, a different partition on the same drive, or a network redundancy system? Which kind of speed is the most
Fast, cheapest, can save data for the longest time?

Consider how to back up:
Is it a full backup (ghost-like) or a partial backup?

Frequency of Backup:
For example, is the MySQL database backed up every day, and how often does it take to complete backups?

What tools are used for backup:
Is it tar or cpio and so on?


What Linux data has the meaning of backup
Files with backup meaning can usually be divided into two categories, one of which is a database of similar network services

Files that the host system needs to back up:
This file is mainly related to the "account"! What are the main account files that need to be backed up? Is/etc/passwd,
/etc/shadow,/etc/group,/etc/gshadow, home/home account, etc., and due to the Linux default host
The information setting parameter file is under/etc/, so as long as you back up this file, then almost all of the profiles are
There's going to be! And because the home directory is the bottom of everyone, naturally also need to back up! Again, since the user will have
Mail it! So, this/var/spool/mail content also needs to backup Yo! Also, because if you've ever changed your own core
, then the information in/boot is important too! So, here's the data you have to back up the files for:
/etc/Entire Directory
/Home Entire Directory
/var/spool/mail
/boot
/root
If you have installed other packages yourself, then/usr/local/also better back up!

Database aspects of network services:
This part of the data can be more and more complex, if your network suite settings are based on the original supply, then your settings file
Most of them are under/etc, so this is not a big problem! But if most of your packages come from a self-contained installation,
/usr/local This directory is quite important! Here we assume that the service suites we provide are all using the original RPM
Installation of! So the data files to be backed up are:
Data Set File:
/etc/Entire Directory
/usr/local/Entire Directory
System www + MySQL:
/var/www Entire directory (home directory of the System)
/var/lib/mysql Entire Directory
Other database data files that you provide on Linux hosts!


Recommended directories to back up:
By the above introduction, then if your hardware or due to the relationship between the funds can not be all the data are backed up,
We recommend that you at least back up these directories!
/boot
/etc
/home
/root
/usr/local
/VAR (note: Some of the staging directories in this directory may not be backed up!) )
Directories that do not need to be backed up:
Some data do not need to be backed up! For example, the/proc that we mentioned in the file and directory system is in the record
The previous system is running on the program (processes), this data does not need to be recorded at all! So just take him off! This
Outside, plug-in machines, such as/mnt inside are loaded with other hard drives, optical drives, floppy disks and so on, these do not need to prepare
Part of it!? So that's it! There are some directories underneath that you don't need to back up!
/dev: Do you want to back up this?
/proc: This really doesn't need a backup!
/MNT: If you do not place your own system in this directory, you do not need to back up.
/tmp: Why save a temporary archive! No backup required!


File code for some devices:
Optical drive:/dev/cdrom
Tape drive:/dev/st0 (SCSI interface),/dev/ht0 (IDE interface)
Floppy disk machine:/DEV/FD0,/DEV/FD1
HDD:/dev/hd[a-d][1-16] (IDE interface),/dev/sd[a-p][1-16] (SCSI interface)
Printer:/dev/lp[0-2]

Usually only tar is used when backing up, unless there is a tape drive or special function. Here's a look at Cpio.
Things! If you have a tape drive, Cpio is a pretty good command, "then why am I
Don't just give him copy of the past back to the location of the good!? "Since you can add compression functionality to the copy process to reduce
The entire storage space consumption, why not compressed?! Of course, it's better to compress it! I still prefer tar,cpio.

Tools for full backup:
Full Backup tool inside, three tools tar, cpio and dump are used very often! As for Cpio, his greatest advantage is
Is "Cpio even the general device files can be copied over!" "Great!" So using Cpio for a full backup is a great
A choice. However, it is important to note that the cpio need to cooperate with find to get a normal action! Please pay special attention here! Other than that
, using cpio often with another hard disk that is completely backed up or a tape drive!

1. Use Cpio to back up and reverse backup
[Root @test/root]# Find/-print | Cpio-covb >/dev/st0 <== Backup to tap
[Root @test/root]# Cpio-iduv </dev/st0 <== by tap to store the data back into the system!
2. Use tar to back up
[Root @test/root]# tar-zcvfp host.tar.gz/--exclude/proc--exclude/mnt--exclude/tmp
[Root @test/root]# TAR-ZXVF host.tar.gz

Basic tools for sub-backup:
As for the partial backup, let's explain it in simple tar!! If we need to back up the data is the daily MySQL
database, because I want to make every day's data into a different file, and to separate the old and new files by date to the most simple!
So I can do this:
[Root @test/root]# tar-zcvf mysql. ' Date +%y-%m-%d '. Tar.gz/var/lib/mysql
If you forget what the above instructions mean, go back to the Bash chapter and take a look!
[Root @test/root]# tar-n ' 2002/07/05 '-ZCVF home.tar.gz/home
Only in a new file than in 2002/07/05, the files under/home will be packaged into the home.tar.gz!

This will enable MySQL database compression to be backed up to the mysql.2002-07-06.tar.gz file, and the date will not
The same! Oh! This way if the database of the system is out of the question, you can reply immediately! And there's a lot of files available.
Reply It! That's good! In addition, you can use the example of the second example above, the latest data backup is good, the other
The information is not altered! Hey! Provide a more perfect way to do it!

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.