Destination:
EST Home Page Products Download a Demo! Press Releases Where to Buy Support Online Manuals Tech Tips Papers and Notes Mailing Lists Register Contact Info Employment Opportunities at EST EST's Affiliations Linux Related Links


Logical Backup Planning Makes Recovery Easier

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:


    /
    /usr
      /lib
      /include
      /adm
    /etc
    /u
      /tjones
      /jgroves
      /refort
    /u2
      /data
      /worksheets
      /artwork
      /graphics


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:



#!/bin/sh
########################
#
# Segregate backups on tape for easier restore access
# Tim Jones, Enhanced Software Technologies, Inc.
# Copyright 1994
#
# 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  bruxpat.local
xs /u/*
xs /u2/*
EOBXP

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
error1=$?
bru -if /dev/nrst0
error2=$?
bru -if /dev/nrst0
error3=$?

mt -f /dev/nrst0 rewind

cat  BACKUP.MSG
The BRU segregated backup finished with the following results:

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

mail root 

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

NOTE:

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

Service Marks, Trademarks, and / or registered trademarks used on this site are the sole properties of their respective owners.
Copyright 1999, Enhanced Software Technologies, Inc. All rights reserved.

Read our privacy statement.

Last modified: Wednesday, 22-Mar-2000 15:34:43 MST