How to back up an open-source Ubuntu Server

Source: Internet
Author: User
Maybe you are used to using GHOST to back up windows OS. It is troublesome to back up the WINDOWS system using GHOST. you need to restart the computing to DOS mode, run the GHOST program, select the backup partition, and back up the file as a gho file. Then start your machine to WINDOWS. If you have never used LINUX, you may be used to using GHOST to back up WINDOWS operating systems. It is troublesome to back up the WINDOWS system using GHOST. you need to restart the computing to DOS mode, run the GHOST program, select the backup partition, and back up the file as a gho file. Then start your machine to WINDOWS. If you have never used LINUX, you must think it is justified. So, if you use a LINUX system, you must say that WINDOWS is just for us to find things. I am now using the Ubuntu system, and while writing this log, I am backing up my system. Well, it's really nice to back up the system while writing logs online.

It is actually very easy to back up Ubuntu. you don't need to restart the system to read and write the system files. Therefore, we can back up the system while the system is running. There is no need for any GHOST software. a small tar compression can be used to back up the system. Before backing up the system, we need to clean up the garbage in the recycle bin.

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/sda7/backup. tgz-C/

If you are using bz2 compressed:

Tar-xvpjf/media/sda7/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. The above Ubuntu system tutorial is transferred. there is an error after backing up the file at the command prompt on the desktop: tar: error exit delayed from previous error. this error does not occur when you enter the pure command!

Related Article

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.