Linux backup and recovery

Source: Internet
Author: User
Backup and recovery Linux-general Linux technology-Linux technology and application information. The following is a detailed description. From http://navarro.blogbus.com/

You are not prepared. Linux does not need tools like Ghost. An old tar command solves all problems. The best thing is that your backup and recovery processes can be performed on a running system, this means that you do not need to shut down and restart, and you do not need to boot the CD to run some strange tools (unless the system is no longer able to boot, you need a liveCD at this time ), you can back up or restore your tasks in an editor.

Back up my system

First, create a directory to store the backup files. Of course, you can directly put the directory under/, but I still created a separate directory, which is more conducive to eliminating these backup files during Backup.

Cd/

Sudo mkdir/backup

Remember to detach external storage devices, such as mobile hard disks and USB disks, before backing up. Of course, if you want to back up data directly to a mobile hard disk, you can do it without detaching it, but you need to exclude it during Backup.

Backup System

Sudo tar-cvpzf/backup/backup-070108.tgz/-- exclude =/proc -- exclude =/lost + found -- exclude =/home/raven/aMuleDownloads -- exclude =/home/raven/Downloads -- exclude =/home/raven /. aMule -- exclude =/media -- exclude =/mnt -- exclude =/sys -- exclude =/backup -- exclude =/home/raven /. virtualBox/VDI/winxp. vdi -- exclude =/home/raven/music -- exclude =/home/raven/vboxshare -- exclude =/home/raven/Books

Let's talk about the tar command.

Parameter: c Indicates creating a file, and outputting information on the terminal during v backup. p reserves the permission of the file system. z uses gzip for compression (j can be used for compression and bz2 for compression, but it will take a little longer). f specifies the file (here is the name of the backup file to be created ).

Here tar-cvpzf/backup/backup-070108.tgz/last this/indicates the directory to be backed up (I backed up the entire system, so use /).

The following -- exclude =/proc is the target to be excluded. Generally, the following directories should be excluded.

/Proc,/lost + found,/media,/mnt,/sys, And the directory/backup where your backup files are stored (or directly exclude your backup files)

Other locations that do not want to be backed up can be added to the backend, such as the location for storing Movie Music and Virtual Disks of virtual machines.

When the backup is completed, a prompt such as tar may occur due to the delay of the previous error. It is negligible, so don't worry.

At last, a backup file will be generated, with a high compression ratio!

Okay. Now let's see how to restore it, or tar:

Cd/

Tar-xvpzf/backup/backup-070108.tgz-C/

The parameter x indicates that extract is released, and the last-C/indicates that the file is decompressed /.

So far, the system is restored to the backup time.

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.