Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Backup Questions 1

Status
Not open for further replies.

Edrondol

IS-IT--Management
Feb 20, 2003
63
US
I recently took over a sys admin position and found that our backup program has not worked in a long time. Our tapes go back a month and they're all bad.

The main issue is that it calls for a second tape, but since it runs at 2 in the morning, no one is here to change it. It times out & sends an error message. In the directory that we are backing up, there are numerous files that can be skipped, but as I'm reverse engineering to see how this thing runs, my attempts at doing so have proven fruitless.

We are running AIX 3.1 on an (old) IBM6000. Here is the script, written eons ago...

# !/bin/sh
#
# Daily backup script by XXXXXXXX
# 21-January-1999
# Modified 12-December-2000
# temporarily backs up only /rims/site1/prod1

# Add other directories to not backup in this script to the following line.
# Separate directory names with a "|".
export IGNOREDIRS="/rims/site1/p1spl|/rims/site1/temp"

# Start of backup directory tree.
export STARTDIR=/rims/site1/prod1

# Device to write backup to:
export BACKDEVICE=/dev/rmt0

# Temporary output file for daily backup...
export OUTFILE=/backup/`/usr/bin/date +"output.%d"`

# Build daily log file headers.
/usr/bin/rm $OUTFILE
echo Backup script started at: `/usr/bin/date` >> $OUTFILE

cd /

# Test the status of the tape.
/usr/bin/mt -f $BACKDEVICE rewind
export TAPE_ERR=$?

# Abort if there is a tape drive error.
if [ "$TAPE_ERR" != "0" ] ; then
echo "!!!!!!!!!!!!!!!!!!!!" >> $OUTFILE
echo " TAPE DRIVE ERROR in script $0! Check tape drive!" >> $OUTFILE
echo "!!!!!!!!!!!!!!!!!!!!" >> $OUTFILE
/usr/bin/mail -s &quot;Tape error on `/usr/bin/date` ($TAPE_ERR).&quot; root < $OUTFILE
exit
fi

echo Tape ready, starting backup at: `/usr/bin/date` >> $OUTFILE

# Make the list of files to backup (find .$STARTDIR -print )
# remove specific directories (grep -vE $IGNOREDIRS)
# and do the backup (backup -iqpvf $BACKDEVICE)
find .$STARTDIR -depth -print | grep -vE $IGNOREDIRS | /usr/sbin/backup -iqpvf $
BACKDEVICE >> $OUTFILE 2>&1

export TAR_ERR=$?

echo Backup finished at: `/usr/bin/date` >> $OUTFILE

if [ &quot;$TAR_ERR&quot; != &quot;0&quot; ] ; then
echo &quot;********************&quot; >> $OUTFILE
echo &quot; ERRORS ENCOUNTERED in script $0! Check previous output!&quot; >> $OUTFI
LE
echo &quot;********************&quot; >> $OUTFILE
/usr/bin/mail -s &quot;Backup error on `/usr/bin/date` ($TAR_ERR).&quot; root < $OUTFILE
fi

# Rewind and eject the tape.
/usr/bin/mt -f $BACKDEVICE rewoffl >> $OUTFILE 2>&1

echo &quot;Completely done, rewound and ejected (`/usr/bin/date`).&quot; >> $OUTFILE
 
There could be several ways to tackle this. Are you saying there are specific files, specific directories, or specific file extensions that can also be skipped?
 
Specific files. They are in format [A-Z]0######.*

Also, the information that I was given says that this compresses the files, but I don't see it. Am I blind?



-Dave
 
Dave:

Not being an AIX person, I can't address the /usr/sbin/backup program - looks like a replacement for tar. GNU tar has a compress flag, but I'm not aware of any other tar having a compress feature.

However, your IGNOREDIRS variable apparently eliminates all strings with those names - directories and files. Is that bad? If you have a regular expression of the files you wish to delete you can do this:

# your regular expression may vary
find . -type f ! -name [A-Z]* -print


This still doesn't address your problem of the tape not being large enough. I sympathize; it's happened to me.

Regards,

Ed
 

The -p option to backup compresses.

From the man page:

-p Specifies that the files be packed, or compressed, before they are archived.
Only files of less than 2GB are packed.

Note: This option should only be used when backing up files from an inactive filesystem.
Modifying a file when a backup is in progress may result in corruption of the backup and an inability to recover the data.
When backing up to a tape device which performs ompression, this option can be omitted.


I think you need to change the script so it does an incremental backup to save space.

Cheers Henrik Morsing
Certified AIX 4.3 Systems Administration
& p690 Technical Support
 
Take a look at mksysb * vgbackup

mksysb will create a bootable tape and backs up everything in the rootvg ( use lsvg to view ) do this once a month

vgbackup will take a copy of any other Volume groups you have. Do these nightly or if you are struggling back these up in rotation

Use the rmt0.1 device if you are doing multiple backups to 1 tape, as rmt0.1 is the no rewind device.

Restores using vgbackup are speedy and easy to manage and you can restore individual files from tape.

I have a script if you would like me to post it.

Regards --
| Mike Nixon
| Unix Admin
| ----------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top