Re: fbackup creating two index files (199 Views)
Reply
Occasional Advisor
nollop
Posts: 10
Registered: ‎10-07-2009
Message 1 of 13 (284 Views)
Accepted Solution

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

 

Please use plain text.
Honored Contributor
Patrick Wallek
Posts: 13,749
Registered: ‎06-21-2000
Message 2 of 13 (254 Views)

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}

Please use plain text.
Occasional Advisor
nollop
Posts: 10
Registered: ‎10-07-2009
Message 3 of 13 (249 Views)

Re: fbackup creating two index files

[ Edited ]

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

Please use plain text.
Honored Contributor
Patrick Wallek
Posts: 13,749
Registered: ‎06-21-2000
Message 4 of 13 (240 Views)

Re: fbackup creating two index files

[ Edited ]

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.

Please use plain text.
Occasional Advisor
nollop
Posts: 10
Registered: ‎10-07-2009
Message 5 of 13 (238 Views)

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.  

Please use plain text.
Honored Contributor
Patrick Wallek
Posts: 13,749
Registered: ‎06-21-2000
Message 6 of 13 (235 Views)

Re: fbackup creating two index files

Post above edited with a theory...

Please use plain text.
Occasional Advisor
nollop
Posts: 10
Registered: ‎10-07-2009
Message 7 of 13 (232 Views)

Re: fbackup creating two index files

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

 

Thanks!

 

Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,953
Registered: ‎03-06-2006
Message 8 of 13 (223 Views)

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

Please use plain text.
Occasional Advisor
nollop
Posts: 10
Registered: ‎10-07-2009
Message 9 of 13 (205 Views)

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

Please use plain text.
Honored Contributor
Patrick Wallek
Posts: 13,749
Registered: ‎06-21-2000
Message 10 of 13 (199 Views)

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.

Please use plain text.
Occasional Advisor
nollop
Posts: 10
Registered: ‎10-07-2009
Message 11 of 13 (190 Views)

Re: fbackup creating two index files

[ Edited ]

Backups seem to be successful as I can read all files successfully.  I have changed the script to use the /dev/rmt/0m device instead of /dev/rmt/0mn device, since I read on man pages that no rewind devices shouldn't be used.  I will monitor Monday's backup to see if this produces the same warning.

 

Please use plain text.
Honored Contributor
Patrick Wallek
Posts: 13,749
Registered: ‎06-21-2000
Message 12 of 13 (184 Views)

Re: fbackup creating two index files

>>I will monitor Monday's backup to see if this produces the same warning.

 

If you always use new tapes, or at least tapes that have never been used with fbackup, on Mondays then you will always get the 'no fbackup header' message.  That is completely normal when using a new to fbackup tape.

 

When you get the 'no fbackup header' message with tapes that have been used with fbackup is when I would be concerned.

Please use plain text.
Occasional Advisor
nollop
Posts: 10
Registered: ‎10-07-2009
Message 13 of 13 (172 Views)

Re: fbackup creating two index files

Turns out some tapes were previously used for a tar backup - hence the warning message about unable to read header.

 

Thanks a lot for the help on this issue.

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation