TSM Topics Feed

Tuesday, June 14, 2011

Drive Matching

While working with a VTL I realized how much I hated matching drive definitions on a LAN-Free client or remote library client and decided to do something about it. So after searching the web and finding a helpful script to pull rmt and serial numbers from the tape drives discovered on the LAN-Free or Lib-Client I worked it into an AIX shell script that will match the drives rmt with the correct drive definition on the library manager. The key to this working is to have the library manager listed in the lib-clients dsm.sys and to define the following TSM script on the library manager.


-=-=-=-=-=-=-TSM Server Script-=-=-=-=-=-=-=-


def script drive_match desc="This script is used by a shell script to match drives to rmts to help create DEFINE PATH statements"
upd script drive_match "select 'define path $1 ' || drive_name || ' srct=server destt=drive libr=' || library_name || ' device=/dev/$2 -"
upd script drive_match " online=yes' from drives where DRIVE_SERIAL='$3' "


-=-=-=-=-=-=-UNIX Shell Script-=-=-=-=-=-=-=-


#!/bin/ksh
ID=`cat /home/tsmadmin/VARS/ADSMID`
PA=`cat /home/tsmadmin/VARS/ADSMPA`
touch ./drv_match.mac
cat /dev/null > ./drv_match.mac
clear
echo "This script will build the DEFINE PATH statements for a server"
echo ""
echo "Enter the Library Manager Name: \c"
read SERV
echo ""
echo "What is the TSM server name these paths are going to be generated for: \c"
read TSMSRV
echo ""
lsdev |grep fscsi | while read FSCS rest
 do
   TAPES=$(lsdev -p $FSCS | grep rmt | grep -v ALT |cut -f1 -d" ")
     for TAPE in $TAPES
       do
         SERIAL=$(lscfg -vl $TAPE | grep Serial | awk -F"." '{printf "%d", $NF}')
         FCS=$(echo $FSCS | sed 's/fscsi/fcs/')
         dsmadmc -id=$ID -pa=$PA -dataonly=yes -commadelimited -servern=$SERV run drive_match $TSMSRV $TAPE $SERIAL | grep -v ANR >> ./drv_match.mac
        done
 done
cat ./drv_match.mac


-=-=-=-=-End Script-=-=-=-=-=-

You'll notice I save the output as a macro so it can be reviewed before executed. If you'd like to run the macro automatically then just add a dsmadmc line at the end.

The following is some sample output:


define path tsm8 VTL3_00332 srct=server destt=drive libr=VTL3 device=/dev/rmt88 online=yes
define path tsm8 VTL3_00336 srct=server destt=drive libr=VTL3 device=/dev/rmt89 online=yes
define path tsm8 VTL3_00340 srct=server destt=drive libr=VTL3 device=/dev/rmt90 online=yes
define path tsm8 VTL4_00444 srct=server destt=drive libr=VTL4 device=/dev/rmt91 online=yes

7 comments:

  1. I use another method. Instead of adding paths to match the devices, I change the devices to match the path with chdev. That way all the library clients can have the same path-device mapping.

    ReplyDelete
  2. Thanks for the "Duh!" moment...Whoever you are! Never thought of chdev, thats a lot easier. I'll keep that one in mind, I could modify the script to match them and then chdev them correctly. That's why I love sharing, since sometimes we all just need a different perspective.

    ReplyDelete
  3. Using Anonymous' idea I found this thread on ADSM.org that discusses the chdev process and provides sample scripts.

    http://www.adsm.org/lists/html/ADSM-L/2009-03/msg00174.html

    ReplyDelete
  4. for physical drives, I used to rename them sorted by WWN, but with VTL now, I use the serial numbers to do it.

    I rename them / order them on my TSM server and then do it exactly the same on all my LAN-FREE clients. Really neat and so easy to manage! You can delete everything whenever needed and just run that little script to set it back up correctly! I never update / change my paths on the TSM server itself.

    I even integrated the load balancing / alternate pathing activation in the script.

    Frank.

    ReplyDelete
  5. Dumb question, but where do you run the shell script, on the UNIX host that the client is on?

    ReplyDelete
  6. Excellent blog right here! Also your site so much up fast!
    What web host are you the usage of? Can I get your associate link for your host?
    I desire my site loaded up as quickly as yours lol

    Check out my page: windows error fix

    ReplyDelete
  7. This site runs off of Google servers. As for the script I just had to use it again and with an alphanumeric serial it is best to swap the

    SERIAL=$(lscfg -vl $TAPE | grep Serial | awk -F"." '{printf "%d", $NF}')

    with this

    SERIAL=$(lscfg -vl $TAPE | grep Serial | awk -F"." '{printf "%s", $NF}')

    changing the value to a string rather than an integer.

    ReplyDelete