Linux system backup

Source: Internet
Author: User

1. Use root permissions to enter the root directory CD/

2. Perform the following command, back up the system,--exclude= exclude useless files

Tar cvpzf backup.tgz--exclude=/proc--exclude=/lost+found--exclude=/backup.tgz--exclude=/mnt--exclude=/sys/

Simply take a look at this command:

"Tar" is, of course, the program we use to back up our systems.

"CVPFZ" is the tar option, meaning "Create profile", "Keep permissions" (keep everything original), "Use gzip to reduce file size".

"Backup.gz" is the file name of the archive file we are going to get.

"/" is the directory we want to back up, here is the entire file system.

Directories that must be excluded from the backup are given between the file name "backup.gz" and the Directory Name "/" to be backed up. Some directories are useless, such as "/proc", "/lost+found", "/sys". Of course, the "backup.gz" file itself must be excluded, otherwise you may get some out of the ordinary results. If you do not exclude "/mnt", other partitions that are mounted on "/mnt" will also be backed up. Also need to confirm that "/media" does not mount anything (such as CD-ROM, mobile hard disk), if there is a mount thing, must be "/media" also excluded.

3. Use the following command to restore the system:
Tar Xvpfz backup.tgz-c/

4. At the end of the restore command, your work is not complete, and do not forget to recreate the directories that were excluded from the backup:
# mkdir Proc
# mkdir Lost+found
# mkdir MNT
# mkdir SYS

Linux system backup

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.