Tar Backup System Method

Source: Internet
Author: User
 

The following describes how to back up the system: 

Open the terminal and enter the following command:

1. Become Root User: sudo Su

2. Go to the root directory: CD/

Then, the following is the complete command that I used to back up my system:
Tar-cvpzf/Media/sda7/backup. tgz -- exclude =/proc -- exclude =/lost + found -- exclude =/mnt -- exclude =/sys -- exclude =/Media/

Next, let's explain a little:
Tar is a backup program.
C-create a backup document
V-verbose mode. The Tar program outputs all information on the screen in real time.
P-Save the license and apply it to all files.
Z-use 'gzip 'to compress the backup file to reduce the size of the backup file.
F-indicates the path where the backup file is stored./Media/sda7/backup. tgz indicates the backup file name in this example. The backup file is backed up in another partition, that is, the original win partition. Because my root directory does not have enough space, I only need to back up it elsewhere.
Let's take a look at the directory we want to include. We don't want to back up everything, because some directories are useless. Make sure that you do not want to include the file, otherwise you will get a very strange result. You do not need to back up anything in the/mnt directory, unless you have other partitions attached to it or you insist on backing up. You must also ensure that no resources are stored in the/Media Directory (for example, any CD or mobile storage media). Otherwise, remove/media.
* The last parameter is the directory we want to save. We want to save everything and use/as the root directory.

Then the System Backup will be restored: 

Warning: Please. For God's sake, please be careful. If you do not understand what you are doing, it is very likely to overwrite your important data, so please be very careful!

Now, let's continue with the example above. We created a backup file named backup. tgz in the directory of another partition (sda7.

One of the wonderful things in Linux is that it can be restored when the system is running, without the need to start a CD or any other mess. Of course, if your system has crashed, you must choose to use live CD, but the results are still the same. You can even remove all the files in the Linux system when it is running. But I won't tell you that command!

Now, let's get down to the truth. This is the command I want to use. If your backup is not in the same position as mine, modify/Media/sda7 accordingly:

Tar-xvpzf/Media/Disk/backup. tgz-C/

If you are using bz2 compressed:

Tar-xvpjf/Media/Disk/backup.tar.bz2-C/

Parameter x tells the tar program to decompress the backup file. -The C parameter specifies the directory to which the tar program is extracted.

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.