NOTE: As of today, I am still solving several issues related to this that are peculiar to the way EMC Networker is implemented. Expect more updates on this issue.
Recently I've been designing a Backup GFS Rotation with EMC Networker (GFS Stands for Grandfather-Father-Son, google will be your friend). Things went quite smoothly up to the point where I had to tell networker to eject some of the tapes for off-site storage.
To make things a bit more understandable, the GFS rotation works upon this scheme:
– Daily backups from monday to thursday
– Weekly backups on friday
– Monthly backups on 1st of month
– Yearly backup on 31 December each year
The aim of a backup being to have data available in case of a crisis or catastrophical failure, we want to have weekly, monthly and yearly tapes stored securely and away of the production site. Because we have a tape library, we are able to manage a variety of tapes that are each set in a dfifferent pool and we have those from weekly monthly and yearly pools moved to the I/O station of the tape library. The I/O station is a tray that allows backup operators to either deposit or withdraw cartridges from the tape library.
Because I am not an expert with Networker (self upskilling has its limits), I have requested help from EMC. A very friendly Technical Support Engineer helped me figure out what was needed to gather the tape labels and to perform the withdrawal. However, it quickly appeared that our tape library doesn't supports 'ADD' and 'REMOVE' commands. I was therefore unable to rely on nsrjb -x -T [tape_label] -w to perform the extraction.
After talking with another TSE, we were able to check that our library (IBM TS3200, 4U) supports at least slot-based operations. That wasn't however very reassuring, as there was no evident way to link the volume label info returned by mminfo into something that would report a slot number or anything that nsrjb would process for the withdrawal operation. The only thing we came up with is that nsrjb launched without parameters prints a list of slots and volumes plus other data on stdout.
Without escape lane, I thought of a solution that would help me to link volume label and slot. The only place where I could get both was when launching nsrjb without parameters. But then, I needed to extract this data and compare it.
I thought that parsing nsrjb stdout with FOR /F would allow me to know which tape is on which library slot. But then I needed to make sure that we process only the tapes that are from today's backup set. Why today? Considering that the job is run only when weekly, monthly or yearly save groups are
ran, and that this is launched immediately after a save group completes, the 'today' parameter is relevant. For example: we are friday 1st october, the monthly job launches, when it finishes, savepnpc starts the required post-backup script (the one relevant to ejection), we check for backups that were completed today (completed just before the backup), tapes are found and are subsequently ejected.
Therefore, we filter the list of savesets returned by mminfo with the 'today' criteria (see full command below).
Then with the variables we have extracted to perform the comparison, we launch a 2nd batch file and pass these variables as script parameters (slot number and volume label). This batch will write an entry in a log file, then unload tapes that can be in the tape reader and moves them to the library, then moves tapes from the library into any available I/O station port.
The solution I designed is made of two scripts:
list.bat -> checks for today backups and returns volume labels, parses nsrjb output, searchs for a match between today's tapes and nsrjb output. If a match is found, the slot number and volume label are passed as parameters to match.bat
match.bat -> launched with two arguments: slot number and volume label. For every volume label, tries to unmount the tape from tape mechanism, moves it to any available I/O station port (in our case, 3 slots), then writes an entry to a logfile.
If your tape library is off-site, you can share this logfile on a network location with the teams that will be collecting the tapes. In order to ensure logging and quality, I recommend making up a yearly calendar with expected collection days and which kind of backup the team is expected to collect, in addition to this, keeping a log file of tape deposits/withdrawals is highly recommended.
I hope this solution will help some of you solve a quite annoying issue!
Cheers for now and stay hooked to the blog for more features!
Max
Here is the code of both files:
list.bat
FOR /F %%A IN ('mminfo -q "client=client_name,savetime>=today" -ot -r barcode') DO FOR /F "skip=3 tokens=1,2,3 delims=: " %%B IN ('nsrjb') DO IF %%A==%%C match.bat %%B %%A
match.bat
REM MATCH.BAT Slot_Number Volume_Label
ECHO "%date% – %time % – Ejecting volume %2 located into slot %1 into ports 1-3" >> C:\tape_withdraw.txt
nsrjb -u %2
nsrjb -w -S %1 -P 1-3