KB Logo

TOLIS Group Knowledge Base

Browse KB by category:
Go to KB #:
Email   Bookmark

How do logical backups simplify restores?

Views: 10538
Votes: 1
Posted: 02 Oct, 2007

Logical Backups Simplify Restores

Large Unix Filesystem Backups Complicate Single File Restores.

As the size of the average Unix filesystem grows to capacities exceeding multiple gigabytes (GB ), restoring a single file from a normal tape device becomes more time consuming and frustrating to users and administrators. With most system utilities, if a file required two hours to be placed onto tape, it will also require two hours to recover. Through the use of proper backup design and management, a backup administrator can reduce the time required for restoring a single file or small group of files.

On every Unix system, no matter what type of tape device you use, there are tools that will enable you to reduce the time and frustration of a single file restore. One of the best kept secrets of Unix backup is the 'mt' command. On SCO systems this utility is called 'tape' while AIX users have come to recognize it as 'tctl'. No matter what it's called, this utility can help you do things with your backups that you probably thought that you'd have to spend large amounts of cash to accomplish.

For the sake of brevity, we won't duplicate the man page for mt (from here on out, read mt to mean whatever your utility is called). However, we will discuss some of the more important options offered.

One of the easiest things to do to reduce restore times is to segregate your backups into filesets, or savesets. For example if the following directory structure existed:


In this case, the /u and /u2 entries are actually mount points for additional filesystems.

One idea would be to backup the /, /u and /u2 paths as separate, segregated entities on tape. The problem is in deciding HOW you will write the data to tape. This is where the mt command comes into play. By using the no-rewind tape device to write the backups, we could use a script similar to the following:

# Segregate backups on tape for easier restore access
# Tim Jones, The TOLIS Group, Inc.
# Copyright (c) 1994,2001
# Permission is granted for use by all other parties

mt -f /dev/nrst0 rewind
# we create an exclude file (bruxpat .local) to include /u and /u2
rm -f bruxpat.local
cat << EOBXP > bruxpat.local
xs /u/*
xs /u2/*

BRUXPAT=bruxpat.local ; export BRUXPAT

bru -cvvvvf /dev/nrst0 -X / # this will backup root,
# but not /u or /u2

# now continue writing to the same tape, adding the /u and /u2
# directories after filemarks on the tape

bru -cvvvvf /dev/nrst0 /u # don't need bruxpat this time
bru -cvvvvf /dev/nrst0 /u2 # same here

# now rewind the tape and verify the backups
mt -f /dev/nrst0 rewind

bru -if /dev/nrst0
bru -if /dev/nrst0
bru -if /dev/nrst0

mt -f /dev/nrst0 rewind

The BRU segregated backup finished with the following results:

if [ $error1 -gt 0 ]
echo "CRC Errors were discovered in backup set #1" >> BACKUP.MSG
if [ $error2 -gt 0 ]
echo "CRC Errors were discovered in backup set #2" >> BACKUP.MSG
if [ $error3 -gt 0 ]
echo "CRC Errors were discovered in backup set #3" >> BACKUP.MSG
tail -20 /usr/adm/bruexeclog >> BACKUP.MSG

mail root < BACKUP.MSG

This will result in three separate, segregated backup/file sets on the same tape. Now, by using mt to space to the appropriate filemark, we can reduce the amount of tape searching required to restore a given file to a single set, instead of the entire tape volume. In this example, the / files will be in the first backup/file set on tape (no filemarks needed), /u will be the second (fsf 1 from a rewound tape) and /u2 will be third (fsf 2 from a rewound tape).

To restore a file from /u/tjones, you would use:

mt -f /dev/nrst0 fsf 1
bru -xvf /dev/nrst0 /u/tjones/lostfile

* The fsf option may be called something else on your system - check your man page for appropriate function names.

Others in this Category
document I think I found, or have found, a bug. How do I report this?
document Linear Tape File System (LTFS) Caveats
document What does 'Connection Reset by Peer' mean?
document How do I calculate the time it will take to backup my data?
document What are the proper settings for my tape drive or library and how does the BRU I/O buffer work?
» More Articles

Powered by KnowledgebasePublisher
Page Load Time: 0.031459 seconds / 31.459 milliseconds.
Page File Size: 25594 bytes.