Linux system backup

Source: Internet
Author: User

One of the biggest advantages of Linux with respect to Windows is that the process of installing a Linux installer only has the process of copying files. There is no process for writing the register, so the Linux system will only have to back up the program files of the previous system after reloading. Put it on the new system again and you can use it.

How to back up depends on how Linux is used and what your backup is for!

This is how I use Linux.

Most of the user applications will be installed by default under/usr/local, and I will also install some of the software under/opt/. Therefore, I need to back up both folders.

The/etc folder retains almost all of the Linux system configuration files, but also needs to be backed up.

I'll put everything else in the home user folder, so it's OK to make a backup of the/I folder.

Suppose you also use a database. Some of the Var folders, such as Lib, may also be backed up, assuming that the kernel has been updated. The/boot folder can also be backed up, but not very significant.

My purpose.

You can eliminate the hassle of configuring Vim and installing software after installing the system again!

Only need to carry out the system update to be able to use!

I'm not a professional, so. Suppose you are doing Linux database maintenance. Then your backup will be much more than that.

1. Back up the user program

/usr/local folder is the installation location of the general user program,

tar -zcpPvf local.tar.gz /usr/local/

/OPT is also often used to store user programs.

tar -zcpPvf opt.tar.gz /opt/
2. Backing up the global parameter configuration file

Most of the configuration under Linux is stored in the/etc/directory,

tar -zcpPvf etc.tar.gz /etc/
3. Back up user folders

Among the monkeyzx for your username.

4. Restoring a backup

The way to restore backups is very easy. Just unzip the tarball into the new system. The absolute path is used when compressing. Unzip can use the following commands under the Random folder,

su roottar -zxpPvf local.tar.gztar -zxpPvf opt.tar.gz tar -zxpPvf etc.tar.gztar -zxpPvf monkeyzx.tar.gz
5. Vim Configuration

I have made a package of my vim configuration, which is handy for porting the previous configuration after the system update, and the configuration file is on GitHub:

Https://github.com/xiahouzuoxin/vim_config

Explanation of the TAR command

-z gzip compression format

-x Tar unpack

-c tar package, create file

-p reserved file permission attribute (lowercase character)

-p reserved Absolute path. In Linux. Prevents the tar package from accidentally overwriting the '/' file, by default the root "/" in the absolute path will be removed. Use-P is reserved.

-V Display compressed information

-F Specifies the package file name

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.