Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Linux Timesaving Techniques For Dummies.pdf
Скачиваний:
59
Добавлен:
15.03.2015
Размер:
15.98 Mб
Скачать

382 Technique 50: Backing Up Your Data

3. On the second day of the cycle (Tuesday), make a temporary copy of Monday’s snapshot file:

#cp /backups/etc.snap \ /backups/etc.tmp

4.Now invoke tar, but this time tell it to read from (and update) the temporary snapshot file rather than the master copy:

#tar -cvlfz /dev/rmt0 \

-g /backups/etc.tmp /etc

tar compares /backups/etc.tmp to the current state of the /etc directory tree and saves only those files that have changed since the first archive in the cycle.

tar also updates the snapshot file (/backups/ etc.tmp), but you’ll overwrite that file on the next day anyway.

Store this backup in a safe place.

5. On every other day in the cycle, repeat Steps 3 and 4.

In an incremental backup, each backup after the initial backup contains all the changes that have occurred between the first full backup and the current state of the system.

On the downside, incremental backups take longer to create, and they consume more media.

On the upside, if you need to restore data, you only need to use two tapes to do it: the initial (full) backup and the most recent incremental.

Restoring from Backup with tar

Restoring from backup with tar is as easy as backing up with tar. Instead of creating archives, you use tar’s extract command to extract the data that you need.

To restore an entire directory tree, move to the root directory and use the following command:

# tar -xzvf /dev/rmt0 /directoryname

To restore a single file, use this command:

# tar -xzvf /dev/rmt0 /directory/filename

You can restore many files (or directories) at once by listing the names at the end of the command line. Be sure to use the same compression options that you used when you created the archive.

If you’ve used an incremental backup scheme, extract the files that you want from the full backup tape first, and then extract the same files from the most recent incremental backup. (If the files that you want to extract haven’t changed since the full backup, they won’t appear in the incremental archive, but that’s okay. You should still try to restore from the incremental archive just in case.)

If you’re keeping incremental backups, you’ll restore two backups: the first backup and then the most recent incremental backup.

Restoring from a differential backup is the same basic procedure, but it takes more time because you have more tapes to go through.

Hopefully you’ve kept simple interim backups of the files you’re most likely to need to restore (see the section, “Targeting bite-sized backups for speedier restores,” earlier in this technique), and you’ll have to restore from a differential backup only in the case of an extreme disaster — we’ll all hope that doesn’t happen.

If your system is damaged to the point where you can’t boot into Linux, don’t panic. Just reinstall Linux and then restore your data from backup.

See — aren’t you glad you have a good backup plan?

Соседние файлы в предмете Операционные системы