Linux system backup and restore

Source: Internet
Author: User
Tags bz2

Linux system backup and restore
Backup system:
1.
To become the root user: Su root
2.
Go to root directory: CD/
3.
To package compression with the TAR command:
Tar CVPJF compressed package name. TAR.BZ2--exclude=/Compressed package name. TAR.GZ2/
Such as:
Tar cvpjf backup.tar.bz2--exclude=/backup.tar.bz2/
Command explanation:
Tar: Package Compression command
CVPJF: Is the tar option, which means "create profile", keep permissions (keep everything original permission), use BZIP2 compression (high compression rate)
BACKUP.TAR.BZ2: Compressed file name
/: Is the directory we want to back up, here is the entire system
--EXCLUDE=/BACKUP.TAR.BZ2: Exclude this file (exclude front is two horizontal lines)
If it is:
Tar cvpzf backup.tgz--exclude=/backup.tgz/
means that the compression method used is different, that is, using gzip to compress
If a hint like this appears in tar
Exiting with failure status due to previous errors
You can view
Ls-ld
Look at its permissions, which is typically displayed: Drwxr-xr-x 3 root root 4096
So you can handle this:
chmod 0777.
Look at the ls-ld and see drwxrwxrwx
Restore System:
Put the above backup.tar.bz2 or backup.tgz in the root directory
1.
To become the root user: Su root
2.
Go to root directory: CD/
3.
If it is back.tar.bz2, then:
Tar xvpfj backup.tar.bz2-c/
Or
Tar Xvpfz backup.tgz-c/
If you have not previously backed up, you can manually create the relevant directories and files

Linux system backup and restore

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.