How to implement backup and restore under Linux

Source: Internet
Author: User
Tags centos server

Reprint Please specify the source http://blog.csdn.net/xingjiarong/article/details/47282687
Recently in the configuration of CentOS server, we all know that the configuration process may be complex, sometimes error, can not configure the error can not be restored to reload the system, so it is important to do a good job of the system backup.

The backup of Linux is actually to save the file in a uniform package, wait until the recovery, and then use these files to overwrite the original file is good.

Backup:

Switch to the root directory (/) of the root user, which must be the root directory, or else the files will be missing. Use the following command to package:

tar  cvpzf  Span class= "hljs-comment" >backup  tgz  / - - exclude=/proc  - - exclude=/lost  +  found  - - exclude=/backup   tgz  - - exclude=/mnt  - - exclude=/sys  

Where Backup.tgz is the name of the backup, followed by the root directory we want to back up. Then there's the directory we're going to remove: we don't want to back up everything because some directories aren't very useful, and make sure you don't add the backup file itself, otherwise you'll get weird results. You may also not want to include the/mnt folder-if you mount other partitions there-you will end up backing up those as well. Also make sure you don't have anything attached to the/media (that is, no CD or removable media is mounted). Otherwise, remove the/media.

Recovery:

To enter the root directory with the root user/, execute the following command:

tar xvpfz backup.tgz -C /

Make sure to recreate the directory you excluded before you do anything else:

mkdir procmkdir lost+foundmkdir mntmkdir sys

/proc Permissions: File owner: Root group: Root owner: Read execution group: Read execute other: Read execute
/lost+found Permissions: File owner: Root group: Root owner: Read Write execution group: Read execute other: Read execute
/MNT Permissions: File owner: Root group: Root owner: Read Write execution group: Read execute other: Read execute
/sys Permissions: File owner: Root group: Root owner: Read Write execution group: Read execute other: Read execute

When you reboot, everything will be exactly the same as when you backed up.

Reference: http://blog.sina.com.cn/s/blog_628c3f9e0102v24j.html

Copyright NOTICE: This article for Bo Master original article, reproduced please indicate the source, view the original article, please visit: Http://blog.csdn.net/xingjiarong

How to implement backup and restore under Linux

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.