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