Linux backup and restoration command skills

Source: Internet
Author: User
Linux system backup and restoration command skills-general Linux technology-Linux technology and application information, the following is a detailed description. Take the most popular Linux version Ubuntu as an Example

Full backup
Open the terminal and enter the following command: 1. Become the root user: sudo su 2. Go to the root directory: cd/

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

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/disk/backup. tgz is the backup file name in this example. The backup file is backed up in another partition.
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.

Restoring the system backup in the future
Tar-xvpzf/media/disk/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. (In this example, yes /)

Author: Xiao Jianguo

List of backup and installation programs

Ubuntu backup software currently installed
Do not delete the/var/cache/apt directory. Run cp before installing the system, and then run cp back.

Generate a list of currently installed software content
Dpkg -- get-selections | grep-v deinstall> buntu. files

Configure sources. list after reinstalling
Sudo apt-get update
Sudo apt-get dist-upgrade
Dpkg--set-selections <ubuntu. files

Sudo dselect

Press I

Then press Enter.
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.