Ubuntu 16.04 Backup and Recovery summary _linux

Source: Internet
Author: User
Tags bz2

Objective

In the backup, the main need to identify which directories do not need to back up, although there are many tutorials on the web, but also to adjust the parameters according to their own situation.

First, clean cache, Recycle Bin, etc.

# Clean up old software cache
sudo apt-get autoclean
# #
clean up all software caches
sudo apt-get #
# Remove orphaned software
that the system no longer uses sudo apt-get autoremove

Ii. use of the tar backup

1. Command and parameter explanation

V: Display detailed compression information

C: Create a tar Package

J: Use BZIP2 compression format

Z: Using gzip compression format

P: Use absolute path

F: Path to the compressed file generated

2. Terminal operation

# Switch to root identity
su-root
# #
Use the GZIP compression format (compressed slightly low but fast)
tar vzcpf/media/chris/linuxdata/backup/ubuntu_ ' Date +%y%m%d_%h '. tar.gz--exclude=/proc--exclude=/dev--exclude=/mnt--exclude=/media--exclude=/lost+found-- Exclude=/cdrom--exclude=/tmp--exclude=/sys--exclude=/home/chris/.cache--exclude=/run/>/media/chris/ Linuxdata/backup/ubuntu_ ' Date +%y%m%d_%h '. Log 2>/media/chris/linuxdata/backup/ubuntu_ ' date +%Y%m%d_%H '. Error
#
# Use BZIP2 compression format (compressed slightly higher, but slow)
tar vjcpf/media/chris/linuxdata/backup/ubuntu_ ' date +%y%m%d_%h '. tar.bz2- -exclude=/proc--exclude=/dev--exclude=/mnt--exclude=/media--exclude=/lost+found--exclude=/cdrom--exclude=/tmp- -exclude=/sys--exclude=/home/chris/.cache--exclude=/run/>/media/chris/linuxdata/backup/ubuntu_ ' Date +%Y%m%d_ %H '. Log 2>/media/chris/linuxdata/backup/ubuntu_ ' date +%y%m%d_%h '. Error

III. Recovery System

1, recommended backup under:/boot and/etc/fstab, and then execute the RESTORE command

2, copy the backup file to/directory, the implementation of the RESTORE command:

# Use the gzip format
su-root
tar vxzpf ubuntu*.tar.gz-c/
#
# Use BZIP2 format for
tar vxjpf ubuntu*.tar.bz2-c/

Summarize

The above is the entire content of this article, I hope the content of this article for everyone's study or work can help, if there is doubt you can message exchange.

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.