IBM Tape drive persistent name in RHEL5

shekarmk

Newcomer
Joined
Feb 3, 2011
Messages
1
Reaction score
0
Points
0
Hi,

We have issue with IBM tape drive upon reboot tape drive sequence changes.
So we would like to set persistent name for tape drives. Please let me know the Udev rule file syntax for the same.

OS

cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.5 (Tikanga)

IBM tape driver rpm installed
rpm -qa |grep lin_tape
lin_taped-1.48.0-1
lin_tape-1.48.0-1

IBM tape drive detected
cat /proc/scsi/IBMtape
lin_tape version: 1.48.0
lin_tape major number: 251
Attached Tape Devices:
Number model SN HBA FO Path
0 ULT3580-TD4 0007855428 lpfc NA
1 ULT3580-TD4 0007867292 lpfc NA
2 ULT3580-TD4 0007867263 lpfc NA


ls -l /dev/IBMtape*
crw-r--r-- 1 root root 251, 3071 Jan 31 01:35 /dev/IBMtape
crw------- 1 root root 251, 0 Jan 31 01:35 /dev/IBMtape0
crw------- 1 root root 251, 1024 Jan 31 01:35 /dev/IBMtape0n
crw------- 1 root root 251, 1 Jan 31 01:35 /dev/IBMtape1
crw------- 1 root root 251, 1025 Jan 31 01:35 /dev/IBMtape1n
crw------- 1 root root 251, 2 Jan 31 01:35 /dev/IBMtape2
crw------- 1 root root 251, 1026 Jan 31 01:35 /dev/IBMtape2n

Thanks,
shekar
 
weren't these rules originally included in the lin_tape driver releases?? i know this changed after lin_tape 1.41 or something close to that. here are mine, but use this at your own risk, this was customized for me by the linux gurus upstairs.

here is mine

[root@itdtsmlnx05 rules.d]# cat 98-lin_tape.rules
KERNEL=="IBMtape*", PROGRAM="/sbin/udev.get_lin_tape_id.sh", SYMLINK="lin_tape/by-id/%c", NAME="%k"
KERNEL=="IBMchanger*", PROGRAM="/sbin/udev.get_lin_tape_id.sh", SYMLINK="lin_tape/by-id/%c", NAME="%k"

[root@itdtsmlnx05 sbin]# cat udev.get_lin_tape_id.sh
#!/bin/sh

# work with udev for IBM SCSI tape device persistent naming support
# Copyright (C) IBM Corporation, 2007

CWD="`pwd`"

SYSFS=/sys

read major_minor < $SYSFS$DEVPATH/dev
major=${major_minor%%:*}
minor=${major_minor##*:}

NAME=`echo $DEVPATH|sed -e 's/.*\/\([a-zA-Z]*\)[0-9n]*$/\1/'`

NONREWOFFSET=1023
PETRONONREWOFFSET=511
PETRONONRESVOFFSET=1023
CHANGEROFFSET=2047

#use the following if petro driver parameter is OFF (default value)
n=''
if [ $minor -gt $NONREWOFFSET -a $minor -lt $CHANGEROFFSET ] ; then
n='n'
fi

#use the following (remove # marks in the lines below and add # marks in the above lines)
# if petro driver parameter is ON
#n=''
#if [ $minor -gt $PETRONONREWOFFSET -a $minor -lt $PETRONONRESVOFFSET ] ; then
# n='n'
#elif [ $minor -gt $PETRONONRESVOFFSET -a $minor -lt $CHANGEROFFSET ] ; then
# NAME='IBMtapenrsv'
#fi

# lin_tape does not have the IOCTL that scsi_id uses however it
# has a sysfs entry pointing to the generic device which does
# support that IOCTL
SYMLINKPATH="$SYSFS$DEVPATH/device/generic"
if [ ! -d $SYMLINKPATH ] ; then
exit 1
fi

cd $SYMLINKPATH
GDEVICEPATH="`pwd -P|sed -e '{ s/\/sys\(.*\)/\1/ }'`"
#use the following line if you want to use WWNNs for tape drives
# and serial numbers for medium changers
#TAPE_ID="`/sbin/scsi_id -gus $GDEVICEPATH`"
WWN="`/sbin/scsi_id -gus $GDEVICEPATH`"
#use the following (remove # mark in the line below and add # in the above line)
# if you want to use serial number for tape drives and medium changers
TAPE_ID="`/sbin/scsi_id -p 0x80 -gus $GDEVICEPATH`"

echo "${WWN} ${TAPE_ID} ${DEVPATH}" >> /tmp/tape-name.txt

echo -n $TAPE_ID-$NAME$n

exit 0
 
Last edited:
when creating definitions for the drives in TSM you have to add the /lin_tape/by-id to the path like this.....

/dev/lin_tape/by-id/SIBM_03584L32_00000*******401-IBMchanger

/dev/lin_tape/by-id/SIBM_ULT3580-TD5_000*******-IBMtape

the *'s are my serial numbers so you will obviously have different numbers there.

hope this helps!!

**FYI we are running RHEL 5.4 but i dont think that makes a difference.
 
forgive my ignorace, is there a similar procedure for windows and aix servers?
 
forgive my ignorace, is there a similar procedure for windows and aix servers?
For AIX there is no problem, you can use rmtx and smcx in the path definition.
For windows you can use SANSURFER with qlogic hba and LIGHTPULSE for Emules hba.
 
We had this problem as well, I though I'd share how we solved it in case it helps anyone else.

We wanted to name our tape drives something like /dev/ibm2109, where this represents drive 09 of frame 1 of IBMLIB2. This helps us quickly map a drive to its location as well as have common and persistent names on all servers.

In order to do this, we have the following UDEV rules:

/etc/udev/rules.d/97-lin_tape.rules
Code:
KERNEL=="IBMtape[0-9]", PROGRAM="/etc/udev/scripts/tapedrive_name.sh %k", SYMLINK+="%c"
KERNEL=="IBMtape[0-9][0-9]", PROGRAM="/etc/udev/scripts/tapedrive_name.sh %k", SYMLINK+="%c"
KERNEL=="IBMchanger*", PROGRAM="/etc/udev/scripts/tapechanger_name.sh %k", SYMLINK+="%c"

/etc/udev/scripts/tapedrive_name.sh
Code:
#!/bin/bash

# Work with udev for IBM SCSI tape device persistent naming support 
# by Alex Iribarren ([email protected])
# $Revision: 1.2 $ $Date: 2009/10/16 16:43:25 $

. /etc/tapenames.conf

SYSFS=/sys/class/lin_tape/
DEVPATH=$1

# lin_tape does not have the IOCTL that scsi_id uses however it
# has a sysfs entry pointing to the generic device which does
# support that IOCTL

SYMLINKPATH="$SYSFS$DEVPATH/device/generic"
if [ ! -d  $SYMLINKPATH ] ; then
    exit 1
fi

cd $SYMLINKPATH
GDEVICEPATH="`pwd -P|sed -e '{ s/\/sys\(.*\)/\1/ }'`"

#use the following line if you want to use WWNNs for tape drives 
# and serial numbers for medium changers 
TAPE_ID="`/sbin/scsi_id -gus $GDEVICEPATH`"

PREFIX=${TAPE_ID:0:15}
FRAME=${TAPE_ID:15:1}
ROW=${TAPE_ID:16:1}

LIBRARY=`name $PREFIX`
FRAME=$(( FRAME + 1 ))
ROW=$(( 0x$ROW ))
if [ ${#ROW} == 1 ]; then
    ROW=0$ROW
fi

echo ${LIBRARY}${FRAME}${ROW}

exit 0

/etc/udev/scripts/tapechanger_name.sh
Code:
#!/bin/bash

# Work with udev for IBM SCSI tape device persistent naming support 
# by Alex Iribarren ([email protected])
# $Revision: 1.1 $ $Date: 2009/11/23 16:43:16 $

. /etc/tapenames.conf

SYSFS=/sys/class/lin_tape/
DEVPATH=$1

# lin_tape does not have the IOCTL that scsi_id uses however it
# has a sysfs entry pointing to the generic device which does
# support that IOCTL

SYMLINKPATH="$SYSFS$DEVPATH/device/generic"
if [ ! -d  $SYMLINKPATH ] ; then
    exit 1
fi

cd $SYMLINKPATH
GDEVICEPATH="`pwd -P|sed -e '{ s/\/sys\(.*\)/\1/ }'`"

#use the following line if you want to use WWNNs for tape drives 
# and serial numbers for medium changers 
TAPE_ID="`/sbin/scsi_id -gus $GDEVICEPATH`"

SERIAL=${TAPE_ID:14:16}

name ${SERIAL}

exit 0

/etc/tapenames.conf
Code:
#!/bin/bash

function name {
    case $1 in
        '0000078A01400402') # for old ibmlib0, '0000078A01400401')
            ret='ibmlib0'
        ;;
        '3500507630f2442') # for old ibmlib0 '3500507630f0073' | '3500507630fc073')
            ret='ibm0'
        ;;
        '0000000A17470401')
            ret='ibmlib2'
        ;;
        '3500507630f1467')
            ret='ibm2'
        ;;
        *)
            logger -p kern.err -t udev "Unable to find library for $1 (WWNN: $TAPE_ID)"
            exit 1
    esac

    echo $ret
}

Any comments or enhancements are more than welcome.

Cheers,
Alex
 
IBM's solution:
-------------------------------------------------------------------------------------------------
Problem(Abstract)
After the lin_tape device driver is upgraded, the lin_tape persistent naming devices are removed from the Linux system.
Cause
Linux device persistent naming is done via Linux udev. In earlier versions of lin_tape device driver udev rule file /etc/udev/rules.d/98-lin_tape.rules and script /sbin/udev.get_lin_tape_id.sh were provided to create the lin_tape persistent devices.
In newer versions of lin_tape device driver, the lin_tape rule file and script used to create the persistent naming devices are removed, as a result, after the upgrade of lin_tape device driver, the persistent naming devices will not be recreated.
Environment
Tivoli Storage Manager Server on Linux with IBM library or IBM drives.
-------------------------------------------------------------------------------------------------

http://www-01.ibm.com/support/docview.wss?uid=swg21584701

also, check this too:
http://www-01.ibm.com/support/docview.wss?uid=swg21459487

Everything works!!!!
i2r.
 
I had another question.
My System is RHEL 5.7 64bit OS and Lin_tape driver is lin_tape-1.76.0-1xx.
I have edit the 98-lin_tape.rules.
When I run start_udev to get lin_tape device persistent naming , it works OK.
But when I reboot the server, the lin_tape device persistent naming does NOT work.
I need to run
start_udev every time to make it work .
What can I do to make it work automatic ?

Thanks all !
 
For RHEL 6 only udev rules are necessary. Any way 6.3 is not officially supported. Even "regular" RHEL 6.3. After setting PMR for lin_tape I was told: downgrade to RHEL 6.2 an then we'll talk :-(
 
Back
Top