Hi, Here's a script modified from various ones found on the Internet :
# cat get_serial.sh #!/bin/bash # work with udev for IBM SCSI tape device persistent naming support SYSFS=/sys echo "IBMDEV;SERIAL;WWN" for IBMDEV in /dev/IBMtape[0-9] do DEVPATH=/class/lin_tape/$(basename $IBMDEV) NAME=$(echo $DEVPATH|sed -e 's/.*\/\([a-zA-Z]*\)[0-9n]*$/\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/ }')" # WWN="$(/sbin/scsi_id -gus $GDEVICEPATH)" # TAPE_ID="$(/sbin/scsi_id -p 0x80 -gs $GDEVICEPATH)" set ${TAPE_ID} SERIAL=$3 # echo "${IBMDEV};${SERIAL};${WWN}" | sed -e "s/\/dev\///" done exit 0 Example running on an RHEL 5 (I don't have an RHEL 4 with devices attached, here MHVTL) # sh get_serial.sh IBMDEV;SERIAL;WWN IBMtape0;XYZZY_A1;350223344ab000100 IBMtape1;XYZZY_A2;350223344ab000200 IBMtape2;XYZZY_A3;350223344ab000300 IBMtape3;XYZZY_A4;350223344ab000400 -- Best regards / Cordialement / مع تحياتي Erwann SIMON ----- Mail original ----- De: "EJ van Loon - SPLXM" <eric-van.l...@klm.com> À: ADSM-L@VM.MARIST.EDU Envoyé: Mardi 2 Juillet 2013 11:52:43 Objet: [ADSM-L] Question for Linux tape experts Hi TSM-ers! I have got a question for Linux experts and specifically expert on tape drives in Linux. We've got some problems with lin_tape on Linux. Our Storage Agent installation scripts use the command cat /proc/scsi/IBMtape to retrieve the serial information of the tape drives. The problem is that this causes a panic on some hosts. IBM identified this to be a known bug in lin_tape 1.66 which has been solved in lin_tape 1.69 and higher, however, 1.66 is the highest release available for RHEL4 servers... So, I'm looking for a way to avoid the cat command, but I need a way to retrieve the drive serials and link them to the Linux tape drive. Does anyone have an alternative method we can use? Thank you very much for any help in advance! Kind regards, Eric van Loon AF/KLM Storage Engineering ******************************************************** For information, services and offers, please visit our web site: http://www.klm.com. This e-mail and any attachment may contain confidential and privileged material intended for the addressee only. If you are not the addressee, you are notified that no part of the e-mail or any attachment may be disclosed, copied or distributed, and that any other action related to this e-mail or attachment is strictly prohibited, and may be unlawful. If you have received this e-mail by error, please notify the sender immediately by return e-mail, and delete this message. Koninklijke Luchtvaart Maatschappij NV (KLM), its subsidiaries and/or its employees shall not be liable for the incorrect or incomplete transmission of this e-mail or any attachments, nor responsible for any delay in receipt. Koninklijke Luchtvaart Maatschappij N.V. (also known as KLM Royal Dutch Airlines) is registered in Amstelveen, The Netherlands, with registered number 33014286 ********************************************************