KB Logo

TOLIS Group Knowledge Base

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



How do logical backups simplify restores?

Views: 9699
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:

/
/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, 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/*
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 << EOBM > 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 < BACKUP.MSG
rm -f BACKUP.MS
G

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.

Others in this Category
document How Much Space Remains on a Tape?
document Clean your hard drive and regain your disk space.
document LTO-5 Tape Drive Head Wear
document What are the proper settings for my tape drive or library and how does the BRU I/O buffer work?
document MegaBytes versus Megabits
» More Articles



RSS
Powered by KnowledgebasePublisher
Page Load Time: 0.031132 seconds / 31.132 milliseconds.
Page File Size: 24331 bytes.