Networker

Re: [Networker] NSR 7.4.5 Entire Catalog dump to text file...????

2012-01-18 16:55:00
Subject: Re: [Networker] NSR 7.4.5 Entire Catalog dump to text file...????
From: Tim Mooney <Tim.Mooney AT NDSU DOT EDU>
To: NETWORKER AT LISTSERV.TEMPLE DOT EDU
Date: Wed, 18 Jan 2012 15:54:33 -0600
In regard to: [Networker] NSR 7.4.5 Entire Catalog dump to text...:

I need to dump an entire Networker catalog, to include a file listing of
what's backed up and retention to text file. The plan is to use scanner
at a later date for specific file recovery on another Legato environment
on an "as needed" basis.

In NetWorker parlance, it's generally not called a "catalog".  I think
what you're asking about is a list of all the files that were backed up
as part of each saveset.

In other words, the customer will say I want:
/u01/app/file_name.txt restored from old_server_long_retired

Put the file on new_server_in_production

I will need to search the dump text file for that file in the date range
specified by the customer, find out what tape and SSID it is in and use
scanner to recover said file.

You generally don't use scanner to recover files.  You typically use
scanner to rebuild either

1) the media database, but only if NetWorker has for some reason forgotten
about a particular tape or the saveset ids on that tape.  This would
generally only happen if the tape was relabelled/recycled (in which case
the data is going to be extremely challenging to recover anyway) or you
purposely deleted the tape from your media database, but kept it around.

2) the client file indexes, which is what lets you browse using the
"recover" command and select individual files for recovery.

Also, if you know the exact path to the file and you know the saveset
that contains the (version of the) file you want, you don't need to
scanner.  You can recover it directly, bypassing the need for a client
file index.

Are you certain that saving a giant text file that lists every file
backed up in every saveset is going to be any more efficient, in any
metric you choose to use, than it would be to just keep the client file
index around for as long as you need to be able to recover data for
that client?

If you're determined to go the giant text file route, then you want to
do something like (assuming both commands being run on a UNIX/Linux box
and a Bourne-like shell)


#! /bin/sh

client=your_exact_client_name_here
server=your_networker_server_name_here
ssid_nsavetime_tmp=`mktemp /tmp/ssid_savetime.XXXXXX`

#
# dump the ssid,nsavetime to a file and iterate over it
#
mminfo -s "$server" -xc, -ot -q "client=$client" -r 'ssid,nsavetime' \
        > $ssid_nsavetime_tmp

#
# get rid of any previous <client>.txt file
#
rm -f "${client}.txt"

#
# save the mminfo output, listing all the things we care about.
# you may want to redirect error output from mminfo, as it may spit out
# warnings about not being able to resolve clients that have been removed
# from the DNS.
#
mminfo -s "$server" -ot -q "client=$client" \
        -r 
'volume,ssid,client,name,savetime(22),nsavetime,level,totalsize,nfiles' \
        > ${client}-mminfo.txt

for l in `egrep -v 'ssid' $ssid_nsavetime_tmp`
do
        ssid=`echo "$l" | cut -d , -f 1`
        nsavetime=`echo "$l" | cut -d , -f 2`

        echo "Contents of ssid=$ssid"                >> "${client}.txt"
        echo "=================================="    >> "${client}.txt"
        # if the saveset isn't browseable, you'll get nothing useful here
        nsrinfo -s "$server" -t "$nsavetime" $client >> "${client}.txt"
        echo ""                                      >> "${client}.txt"
done

rm -f $ssid_nsavetime_tmp



I'm just giving you rope here, though.  I'm not responsible for any
unfortunate circumstances you find yourself in because of that rope.  ;-)

Tim
--
Tim Mooney                                             Tim.Mooney AT ndsu DOT 
edu
Enterprise Computing & Infrastructure                  701-231-1076 (Voice)
Room 242-J6, IACC Building                             701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164

To sign off this list, send email to listserv AT listserv.temple DOT edu and type 
"signoff networker" in the body of the email. Please write to networker-request 
AT listserv.temple DOT edu if you have any problems with this list. You can access the 
archives at http://listserv.temple.edu/archives/networker.html or
via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER