Linux study NOTE _ 9 _ file system management _ 4 _ file backup

Source: Internet
Author: User
Tags add time
[Preface: 1. Awareness of backup 2. ro or unmount3 backup partition 4. Data compression [Preface: 1. Awareness of backup
2. backup partition ro or unmount
3. Data compression
4. verify md5sum-c
5. encryption processing GunPG asymmetric key encryption]

I. potential threats to the system

System hardware fault software fault power fault user misoperation man-made damage contents in cache not written into disk in time natural disaster

II. selection of backup media

Backup media: removable storage devices for disks [via network servers]
Generally, when selecting backup media, you must weigh the reliability, speed, and price. generally, choose hard disks and tape drives.

III. backup policy

Full Backup
Perform a full backup of the system at intervals. in this way, once a system failure occurs during the backup interval, data is lost.
When the backup fails, you can use the backup data to recover the data from the previous backup.
Incremental Backup
A full backup is performed first, and then a backup is performed at intervals of a short period of time, but only changes in each short period of time are backed up.
.
In practice, the two are used in combination.

IV. backup classification

System Backup
Back up operating systems and applications
Objective: to quickly and completely recover system operation after system crash
It mainly backs up/etc,/boot,/var/log,/usr/local, and so on. generally, it is performed only when the system content changes.
User backup
Implements the backup/home of user files, and frequent changes to user data
Generally, incremental backup is used.

5. record changes and create backup logs

Record system changes: record the detailed descriptions of system changes and the reasons for the changes
Create backup log: use the backup log table

Secure

[Example of a backup log table]

Machine name, IP address, storage location
Backup time
Backup media and ID
Backup File system
BACKUP directories and files
Backup command used
Backup personnel and others

[Instance]

I. cp command backup example
Cp-Rpu backup directory target Directory
-R backs up directories.
-P: Keep the backup directory attributes.
-U incremental backup
Remote Backup: scp

II. example of tar command backup

Backup
1. tar-zcf/backup/sys_20110303.tar.gz/etc/boot
Back up the/etc and/boot directories. you can package multiple directories at the same time.
2. tar-zcf backup_user_20110303.tar.gz/etc/passwd/etc/shadow
/Etc/group/etc/gshadow
Back up a specified file in the/etc directory
3. tar-ztf backup_user_20110303.tar.gz
Check the files in the backup package if you do not understand the package.

Restore

1. tar-zxf/backup/etc_20110303.tar.gz
Restore the/etc directory. by default, it is restored to the source directory of the packaged file.-C can specify the restore directory.
2. ar-zxf backup_user_20110303.tar.gz etc/group
Only recover the specified file in the backup, create the etc directory under the current directory, and then restore the group file to it.

Proceed. Note that there is no/symbol before The etc directory.

Backup best practices
1. tar-rf backup_user_20110303.tar/etc/default/useradd/etc/login. defs append the content of/etc/default/useradd and/etc/login. defs
Backup_user_20110303.tar
2. tar-uf backup_user_20110303.tar/etc/passwd
Append the modified content in the/etc/passwd directory to the backup file.
[*-R and-u options can only be used for tar packages]
3. tar-zcf/backup/etc _ $ (date ready before f).tar.gz/etc
Add time (year, month, and day) for backup file name)
4. tar-zcf/backup/etc _ $ (date ready policy.w.m.w.d-w.hsf-m=.tar.gz/etc
Add year, month, day, hour, minute

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.