Operating System - HP-UX
1748149 Members
3598 Online
108758 Solutions
New Discussion

Re: fbackup creating two index files

 
SOLVED
Go to solution
nollop
Occasional Advisor

fbackup creating two index files

Hi,

I have a simple backup script using fbackup to read from a graph file.  Each time I use a new tape, I notice that two index files are being created - the first one is empty, the second one (time stamped a minute after the first index file) is the correct file with a list of indexed files.

 

This is the backupscript I am using:

#!/usr/bin/sh 

LOGFILE=/tmp/backupindex.`date +%Y-%m-%d-%H:%M`

LOGFILE1=/tmp/backuplog.`date +%Y-%m-%d-%H:%M`

 

TAPEDRIVE=/dev/rmt/0mn

 

#Rewind tape

mt -f $TAPEDRIVE rewind >> $LOGFILE

 

fbackup -0u -f $TAPEDRIVE -g /tmp/backupgraph -I /tmp/backupindex.`date +%Y-%m-%d-%H:%M` 2> /tmp/backuplog.`date +%Y-%m-%d-%H:%M`

 

mailx -s "Backup to Tape" admin@abc.com < $LOGFILE

mailx -s "Backup to Tape" admin@abc.com < $LOGFILE1

 

echo backup complete 

 

Does anyone know why such behaviour?

 

Thank you

 

12 REPLIES 12
Patrick Wallek
Honored Contributor
Solution

Re: fbackup creating two index files

The reason is that you are specifying an index file name in your 'fbackup' command line rather than using the $LOGFILE variable you have already defined, so you get different time stamps.

 

Here is what I would do:

 

#!/usr/bin/sh 

LOGFILE=/tmp/backupindex.$(date +%Y-%m-%d-%H:%M)

LOGFILE1=/tmp/backuplog.$(date +%Y-%m-%d-%H:%M)

 

TAPEDRIVE=/dev/rmt/0mn

 

#Rewind tape

mt -f $TAPEDRIVE rewind >> ${LOGFILE1}

 

fbackup -0u -f $TAPEDRIVE -g /tmp/backupgraph -I ${LOGFILE} 2> ${LOGFILE1}

 

mailx -s "Backup to Tape" admin@abc.com < ${LOGFILE}

mailx -s "Backup to Tape" admin@abc.com < ${LOGFILE1}

nollop
Occasional Advisor

Re: fbackup creating two index files

Hi Patrick,

 

I get that I am creating another file in the script.

 

But why is it creating two index files each time?  I am only noticing this problem on Mondays, when I use a new tape media. On the remaining days, when I overwrite the tape, I get only one (correct) index file.

 

Thanks

Patrick Wallek
Honored Contributor

Re: fbackup creating two index files

With the script that you provided you will always get 2 /tmp/backupindex files created.  The first will be created when you rewind the tape, which is probably the empty one you see.  The second file will be created by the fbackup command itself and will be the one with all of your files in it.

 

First file created here:

LOGFILE=/tmp/backupindex.`date +%Y-%m-%d-%H:%M`

mt -f $TAPEDRIVE rewind >> $LOGFILE

 

Second file created here with the different time stamp:

fbackup -0u -f $TAPEDRIVE -g /tmp/backupgraph -I /tmp/backupindex.`date +%Y-%m-%d-%H:%M` 2> /tmp/backuplog.`date +%Y-%m-%d-%H:%M`

 

What may be occurring is that when  you use a new piece of media, fbackup has to create the fbackup header on the tape.  That takes a little bit of time.  It may be that this amount of time is enough that the file specified on the fbackup command line will have a different time stamp.

 

Basically the scenario is this:

 

Previously used media:

mt command is run and creates /tmp/backupindex.2014-04-25-09:19, which is probably empty.

fbackup runs, doesn't have to do much with the tape header, and starts writing to the same file name.

 

New media:

mt command is run and creates /tmp/backupindex.2014-04-25-09:19, which is probably empty.

fbackups runs, sees that the media is new, does its thing with creating the fbackup header, and then starts backuping up.  When it gets to the point of creating a new file it creates /tmp/backupindex.2014-04-25-09:20 because the additional tasks have taken more time.

 

If you use the $LOGFILE variable in the fbackup command line, this will no longer happen.

nollop
Occasional Advisor

Re: fbackup creating two index files

Actually no, I am only getting two LOGFILE (the index file) on Mondays when I use a new tape.  Otherwise on the other days (Tuesday-Friday) I only get one index file.  On all days I only get one backup log file (LOGFILE1).

 

Strange??  That is why I was thinking there is something wrong with backups on Mondays.  

Patrick Wallek
Honored Contributor

Re: fbackup creating two index files

Post above edited with a theory...

nollop
Occasional Advisor

Re: fbackup creating two index files

Makes sense now.  I'll try this and let you know.

 

Thanks!

 

Dennis Handly
Acclaimed Contributor

Re: fbackup creating two index files

>specifying an index file name in your fbackup command line rather than using the $LOGFILE

 

Sure looks like it.  But the script can be improved to make sure the timestamps for the two files are the same:

TS=$(date +%Y-%m-%d-%H:%M)

LOGFILE=/tmp/backupindex.$TS

LOGFILE1=/tmp/backuplog.$TS

 

And the two mail messages combined using a here doc:

mailx -s "Backup to Tape" admin@abc.com <<EOF

Index file

==========

$(< $LOGFILE)

 

Log file

========

$(< $LOGFILE1)

EOF

nollop
Occasional Advisor

Re: fbackup creating two index files

So, changing the script did result in one backup index file.  Thanks for pointing this out.

 

One more question, I am getting a "fbackup(3205): WARNING: unable to read a volume header " even when NOT using new tapes, but using tape with a fbackup already on them.  Is such a warning message normal?  What is strange that I am not getting a warning for every used tape.

 

Thanks,

Tiziana

Patrick Wallek
Honored Contributor

Re: fbackup creating two index files

If fbackup cannot read a tape header on tapes that have already been used (only?) by fbackup, I would worry about the viability of the backups on those tapes.

 

Some tests I would do (all assume a tape drive of /dev/rmt/1mn -- use whatever is correct for you):

 

1) Make sure you can read the fbackup header:

 

# frecover -V /tmp/fbackup-tape-header.txt -f /dev/rmt/1m

 

2) Make sure you can read the fbackup file index:

 

# frecover -I /tmp/fbackup-tape-index.txt -f /dev/rmt/1m

 

3) Try to read all files from the tape (pretend to recover, but do not write any files to disk):

 

# frecover -rNvf /dev/rmt/1m

 

If none of the above work on a tape that was written by fbackup, then I would also check to make sure that you don't have another process (an Ignite make_tape_recovery or a tar of some sort) that is overwriting your fbackup after it has completed.