Linux (2.4.21-9.30)识别HP MSL 6000磁带机的机械手(已解决,并付上了解决文档)

时间:2008-01-16 13:31:04  来源:  作者:

硬件环境:
PC SERVER:IBM X245 
FC HBA      :QLOGIC 2312
Tape Library : HP MSL 6000
软件环境:
RedHat AS 3 (2.4.21-9.30 ) x86

目标:如何在Linux上使用机械手设备,目前Linux上已经可以使用磁带驱动器(已加载了qla2300驱动,可以使用HBA),若有兄弟知道如何加载,请告知,谢谢


以下为硬件信息:
cat /proc/scsi/scsi
引用:Host: scsi3 Channel: 00 Id: 03 Lun: 00
  Vendor: HP       Model: Ultrium 2-SCSI   Rev: F43W
  Type:   Sequential-Access                ANSI SCSI revision: 03
Host: scsi3 Channel: 00 Id: 03 Lun: 01
  Vendor: HP       Model: Ultrium 2-SCSI   Rev: F43W
  Type:   Sequential-Access                ANSI SCSI revision: 03
Host: scsi3 Channel: 00 Id: 03 Lun: 02
  Vendor: HP       Model: NS E1200-160     Rev: 5606
  Type:   Unknown                          ANSI SCSI revision: 0


mtx测试/dev/sgo设备信息
引用:mtx: Request Sense: Long Report=yes
mtx: Request Sense: Valid Residual=no
mtx: Request Sense: Error Code=0 (Unknown?!)
mtx: Request Sense: Sense Key=No Sense
mtx: Request Sense: FileMark=no
mtx: Request Sense: EOM=no
mtx: Request Sense: ILI=no
mtx: Request Sense: Additional Sense Code = 00
mtx: Request Sense: Additional Sense Qualifier = 00
mtx: Request Sense: BPV=no
mtx: Request Sense: Error in CDB=no
mtx: Request Sense: SKSV=no
READ ELEMENT STATUS Command Failed



/proc/scsi目录信息

引用:Administrator@wylon-rf /cygdrive/c/scsi
$ ls
aic7xxx  ips  qla2300  scsi  sg
Administrator@wylon-rf /cygdrive/c/scsi/sg
$ ls
allow_dio  debug  def_reserved_size  device_hdr  device_strs  devices  host_hdr  host_strs  hosts  version



dmesg信息
引用:st: Version 20040102, bufsize 32768, max init. bufs 4, s/g segs 16
Attached scsi tape st0 at scsi3, channel 0, id 3, lun 0
Attached scsi tape st1 at scsi3, channel 0, id 3, lun 



[ 本帖最后由 wylon 于 2007-12-13 13:00 编辑 ]



 wylon 回复于:2007-12-12 13:57:01

问题终于搞定了,以下为故障解决方法

Linux下使用HP MSL 6060磁带库
硬件:
服务器:Dell PowerEdge 6650 
HBA卡:Qlogic 2312
软件:
OS:RedFlag Linux DC Server 4.1 SP1 x86
mtx:mtx-1.2.18-1.i386.rpm
HBA卡驱动:
(SP1系统核心默认用的qla驱动为7.02,只要qla驱动高于或者等于7.06都可以识别到机械手)
qla2x00-v7.07.06-dc4.1-sp1-ia32.tgz
hp_qla2x00-7.07.05.08-dc4.1-sp1-ia32.tgz


几点需要注意
1. 系统能否识别磁带库的机械手,主要取决于HBA的驱动;若通过HBA能够识别到磁带库的驱动器(st0)设备,而不能识别机械手,可以通过更新HBA驱动解决(HBA驱动建议用磁带库厂家提供的)
2. 系统识别机械手的设备号在重启系统之后会改变,可以通过scsidev软件来绑定
3. 使用mtx作磁带库操作建议会阅读MAN文档

使用MSL 6000磁带库操作步骤如下:
一. 更新qla驱动
1. 确认QLA驱动版本型号
cat /proc/scsi/qla2300/2或者3,文件头会显示QLA Driver version

QLogic PCI to Fibre Channel Host Adapter for QLA2340         :
        Firmware version:  3.03.19, Driver version 7.07.0

2. 更新驱动
tar zxvf qla2x00-7.07.06-dc4.1-sp1-ia32.zip -C /

rmmod qla2300
depmod -a
cd /lib/modules/`uname-r `/kernel/drivers/scsi
modprobe qla2300
dmesg | grep -B 10 -A 10 st0
dmesg | grep -B 10 -A 10 sg0


检测是否有st及sg设备挂载的信息,如
[1] 若系统能够识别出机械手,在cat /proc/scsi/scsi中会显示出以下信息,
[2] Model信息为磁带库型号:MSL 6000 series
[3] Type信息为Medium Changer,这个type的信息无论是HP磁带库或者IBM磁带库都为此信息
[4] 请记住cat /proc/scsi/sci信息中的“Host: scsi3 Channel: 00 Id: 00 Lun: 00”,可以以此识别系统上真正的机械手挂载点

详细的/proc/scsi/scsi信息
cat /proc/scsi/scsi

引用:[color=Red]Host: scsi3 Channel: 00 Id: 00 Lun: 00
  Vendor: HP       Model: MSL6000 Series   Rev: 0430
  Type:   Medium Changer                   ANSI SCSI revision: 02[/color]
Host: scsi3 Channel: 00 Id: 00 Lun: 01
  Vendor: HP       Model: Ultrium 2-SCSI   Rev: F43W
  Type:   Sequential-Access                ANSI SCSI revision: 03
Host: scsi3 Channel: 00 Id: 00 Lun: 02
  Vendor: HP       Model: Ultrium 2-SCSI   Rev: F43W
  Type:   Sequential-Access                ANSI SCSI revision: 03
Host: scsi3 Channel: 00 Id: 00 Lun: 03
  Vendor: HP       Model: Ultrium 2-SCSI   Rev: F43W
  Type:   Sequential-Access                ANSI SCSI revision: 03
Host: scsi3 Channel: 00 Id: 00 Lun: 04
  Vendor: HP       Model: Ultrium 2-SCSI   Rev: F43W
  Type:   Sequential-Access                ANSI SCSI revision: 03
Host: scsi3 Channel: 00 Id: 00 Lun: 05
  Vendor: HP       Model: NS E1200-160     Rev: 5669
Type:   Unknown                          ANSI SCSI revision: 0


dmesg信息
引用:st: Version 20040102, bufsize 32768, max init. bufs 4, s/g segs 16
Attached scsi tape st0 at scsi3, channel 0, id 0, lun 1
Attached scsi tape st1 at scsi3, channel 0, id 0, lun 2
Attached scsi tape st2 at scsi3, channel 0, id 0, lun 3
Attached scsi tape st3 at scsi3, channel 0, id 0, lun 4
Attached scsi generic sg1 at scsi1, channel 4, id 6, lun 0,  type 3
Attached scsi generic sg42 at scsi3, channel 0, id 0, lun 0,  type 8
Attached scsi generic sg47 at scsi3, channel 0, id 0, lun 5,  type 1



note:一般磁带库有四个驱动器(st),一个机械手(sg),N多个slot(也就是放磁带的插槽)
[1] 从dmesg信息显示驱动器已(st[0-3])已经识别
[2] 从dmesg信息显示有三个机械手,这里就有问题,需要确认哪一个是真正的机械手

从cat /proc/scsi/scsi和dmesg的信息可以判断出哪个是真正的机械手
引用:Host: scsi3 Channel: 00 Id: 00 Lun: 00
  Vendor: HP       Model: MSL6000 Series   Rev: 0430
Attached scsi generic sg1 at scsi1, channel 4, id 6, lun 0,  type 3
Attached scsi generic sg42 at scsi3, channel 0, id 0, lun 0,  type 8
Attached scsi generic sg47 at scsi3, channel 0, id 0, lun 5,  type 1



很明显,从host、channel、id、lun的设备号可以分析得出机械手是挂载在sg42上
二. 绑定linux系统的设备名 
linux系统允许为设备起便于记忆的名称,但是这带来了另一个问题,每次启动新设备的名称是可变的。如果由于管理原因,某次启动没有加载磁带库驱动程序,那么下一次启动后磁带库设备的名称有可能发生变化。特别对于设备多的时候,会造成很大的麻烦。 

为了避免此麻烦,建议安装使用scsidev。
scsidev的设备名是根据设备的scsi属性对应的,scsidev的设备名即使在设备不可用的时候也不改变。 
1. 安装: 
引用:[root@wylonwong /root]# tar xzf scsidev-2.22.tar.gz 
[root@wylonwong /root]# cd scsidev 
[root@wylonwong scsidev]# ./configure 
creating cache ./config.cache 
checking for gcc... gcc 
checking whether the C compiler (gcc ) works... yes 
checking whether the C compiler (gcc ) is a cross-compiler... no 
checking whether we are using GNU C... yes 
checking whether gcc accepts -g... yes 
checking for working const... yes 
checking how to run the C preprocessor... gcc -E 
checking for linux/scsi.h... no 
checking for scsi/scsi.h... yes 
checking for /usr/src/linux/drivers/scsi/scsi.h... yes 
checking for a BSD compatible install... /usr/bin/install -c 
updating cache ./config.cache 
creating ./config.status 
creating Makefile 
creating config.h 
[root@wylonwong scsidev]# 
[root@wylonwong scsidev]# make 
gcc -g -O2 -Wall -DVERSION="2.22" -o scsidev scsidev.c 
[root@wylonwong scsidev]# make install 
install -o root -g root -m 755 -s scsidev /bin 
install -o root -g root -m 644 scsidev.8 /usr/share/man/man8 
gzip -9f /usr/share/man/man8/scsidev.8 
if [ ! -d /dev/scsi ]; then mkdir /dev/scsi; fi 
#install -d /usr/share/doc/packages/scsidev 
#install COPYING boot.diff README scsi.alias /usr/share/doc/packages/scsidev/ 



2. 创建scsidev的设备名: 
引用:[root@wylonwong scsidev]# scsidev -sdn 
Found /dev/scsi/sgh0-0c0i0l0 (Type 01) R on Adaptec AHA274x/284x/294x 
(EISA/VLB/PCI-Fast SCSI) 5.2.4/5.2.0 
Found /dev/scsi/sgh0-0c0i1l0 (Type 01) R on Adaptec AHA274x/284x/294x 
(EISA/VLB/PCI-Fast SCSI) 5.2.4/5.2.0 
Found /dev/scsi/sgh0-0c0i6l0 (Type 08) R on Adaptec AHA274x/284x/294x 
(EISA/VLB/PCI-Fast SCSI) 5.2.4/5.2.0 
Serial number of /dev/scsi/sgh0-0c0i6l0: "IBM7801954" 
Serial number of /dev/scsi/sth0-0c0i1l0: "6811007030" 
Serial number of /dev/scsi/sgh0-0c0i1l0: "6811007030" 
Serial number of /dev/scsi/sth0-0c0i0l0: "6811020764" 
Serial number of /dev/scsi/sgh0-0c0i0l0: "6811020764" 



3. 得到scsidev设备: 
引用:[root@wylonwong scsidev]# ls /dev/scsi/ 
nsth0-0c0i0l0 sgh0-0c0i0l0 sgh0-0c0i6l0 sth0-0c0i1l0 
nsth0-0c0i1l0 sgh0-0c0i1l0 sth0-0c0i0l0



三. 磁带库操作
1. 使用mtx包,主要用于控制机械手作导带换带、连接slot(插槽)到driver(驱动器)操作
红旗Linux DC Server 4.1有自带mtx-1.2.18-1.i386.rpm安装包,在第一张光盘,安装完之后,会在/usr/sbin/mtx
[1] mtx作检查磁带库状态操作

[root@wylonwong scsidev]#mtx ?Cf  /dev/sg42  status

引用:Storage Changer /dev/sg42:4 Drives, 60 Slots ( 2 Import/Export )
Data Transfer Element 0:Empty
Data Transfer Element 1:Empty
Data Transfer Element 2:Empty
Data Transfer Element 3:Empty
      Storage Element 1:Full 
      Storage Element 2:Full 
      Storage Element 3:Full 
      Storage Element 4:Full 
      Storage Element 5:Full 
      Storage Element 6:Full 
      Storage Element 7:Full 
      Storage Element 8:Full 
      Storage Element 9:Full 
      Storage Element 10:Full 
      Storage Element 11:Empty
      Storage Element 12:Empty
      Storage Element 13:Empty
      Storage Element 14:Empty
      Storage Element 15:Full 
      Storage Element 16:Full 
      Storage Element 17:Full 
      Storage Element 18:Full 
      Storage Element 19:Full 
      Storage Element 20:Full 
      Storage Element 21:Full 
      Storage Element 22:Empty
      Storage Element 23:Full 
      Storage Element 24:Empty
      Storage Element 25:Empty
      Storage Element 26:Empty
      Storage Element 27:Empty
      Storage Element 28:Empty
      Storage Element 29:Empty
      Storage Element 30:Full :VolumeTag=NK0224L1                        
      Storage Element 31:Full :VolumeTag=NK0225L1                        
      Storage Element 32:Full 
      Storage Element 33:Full 
      Storage Element 34:Full 
      Storage Element 35:Full 
      Storage Element 36:Full 
      Storage Element 37:Full 
      Storage Element 38:Full 
      Storage Element 39:Full 
      Storage Element 40:Empty
      Storage Element 41:Empty
      Storage Element 42:Empty
      Storage Element 43:Empty
      Storage Element 44:Empty
      Storage Element 45:Full 
      Storage Element 46:Full 
      Storage Element 47:Empty
      Storage Element 48:Empty
      Storage Element 49:Empty
      Storage Element 50:Empty
      Storage Element 51:Full 
      Storage Element 52:Full 
      Storage Element 53:Full 
      Storage Element 54:Full 
      Storage Element 55:Empty
      Storage Element 56:Full 
      Storage Element 57:Full 
      Storage Element 58:Full 
      Storage Element 59 IMPORT/EXPORT:Empty
      Storage Element 60 IMPORT/EXPORT:Empty



从以上信息显示4个驱动器(driver)全为空,有60个slot,其中有磁带的slot显示为Full,那么我们可以做将slot中的磁带放到驱动器中

[2] 放带操作
命令格式为mtx ?Cf 机械手设备号 slot号 driver号
引用:[root@wylonwong scsidev]#mtx ?Cf  /dev/sg42 load 56 0


[3] 拨带操作
引用:[root@wylonwong scsidev]#mtx ?Cf  /dev/sg42 unload 56 0


除了以上简单操作之外,还可以实现将slot移位,如将原有的slot 56的磁带移动到50,这只是逻辑上的移动;
更详细的操作请查阅man mtx

四. 重做核心
加载QLA驱动之后,必须重启系统测试QLA驱动是否加载成功,重启之后再检查磁带机的驱动器(st)和机械手(sg)是否识别到,若识别到,一切OK

[1] 备份原先操作核心
引用:cp ?Ca  /boot/initrd-`uname -r`.img  /boot/initrd-`uname -r`-`date +%Y%m%d`.img


[2] 重做核心命令:
引用:mkinitrd -f /boot/initrd-`uname -r`.img `uname -r`


参考资料:

[ 本帖最后由 wylon 于 2007-12-12 13:58 编辑 ]


 maping 回复于:2007-12-13 16:35:19

这么好的文件怎么没有人加精啊?


 ry715 回复于:2007-12-14 17:22:53

我看的时候已经是精华帖了


 sqmax 回复于:2007-12-14 18:51:41

其实我感觉就是个驱动的问题


 topchn 回复于:2007-12-20 13:37:21

把表情去了吧。


 topchn 回复于:2007-12-20 15:46:48

:emn25:


 topchn 回复于:2007-12-20 15:47:48

:cool


 saintdragon 回复于:2007-12-21 16:43:21

支持经验分享!




原文链接:http://bbs.chinaunix.net/viewthread.php?tid=1023134
转载请注明作者名及原文出处


文章评论

共有 位网友发表了评论 查看完整内容