linux中LTO设备可以使用linux内带的驱动程序,也可以使用IBM提供的 驱动程序。同时LTO有SCSI和光纤两种连接方式。linux分为p系列和pc服务器 这样就得到2*2*2=8种操作方法。我们这里仅以SCSI连接的pc服务器linux 内带的驱动程序的情况为例。
如果在Linux中需要改变默认的参数(如块大小等), 可以使用下面的方法:
1)确定Linux中要修改的设备
1.1)假设我们要查找通过SCSI连接的3583上的驱动器:
[root@diomede /root]# dmesg
(...)
(我们可以在下面的信息中得知scsi0设备上发现了lto设备) SCSI subsystem driver Revision: 1.00 PCI: Found IRQ 10 for device 00:10.0 scsi0 : Adaptec AIC7XXX EISA/VLB/PCI SCSI HBA DRIVER, Rev 6.2.1 <Adaptec 29160 Ultra160 SCSI adapter> aic7892: Ultra160 Wide Channel A, SCSI Id=7, 32/255 SCBs Vendor: IBM Model: ULT3580-TD1 Rev: 16E0 Type: Sequential-Access ANSI SCSI revision: 03 (scsi0:A:0): 80.000MB/s transfers (40.000MHz, offset 23, 16bit) Vendor: IBM Model: ULT3580-TD1 Rev: 16E0 Type: Sequential-Access ANSI SCSI revision: 03 (scsi0:A:1): 80.000MB/s transfers (40.000MHz, offset 23, 16bit) Vendor: IBM Model: ULT3583-TL Rev: 2.50 Type: Medium Changer ANSI SCSI revision: 02
(...)
(根据前面的情况,我们在后面查找scsi0设备上的lto设备的设备名) st: Version 20011003, bufsize 262144, wrt 65536, max init. bufs 4, s/g segs 16 Attached scsi tape st0 at scsi0, channel 0, id 0, lun 0 Attached scsi tape st1 at scsi0, channel 0, id 1, lun 0 Attached scsi generic sg2 at scsi0, channel 0, id 6, lun 0, type 8
所以我们可以断定
scsi0卡的通道0上有: st0:驱动器SCSI ID=0 st0:驱动器SCSI ID=1 sg2:机械臂SCSI ID=6
1.2)linux系统的设备名可能变化。 linux系统允许为设备起便于记忆的名称,但是这带来了另一个问题,每次启动新设备的 名称是可变的。如果由于管理原因,某次启动没有加载磁带库驱动程序,那么下一次启动 后磁带库设备的名称有可能发生变化。特别对于设备多的时候,会造成很大的麻烦。 为了避免此麻烦,建议安装使用scsidev。 scsidev的设备名是根据设备的scsi属性对应的。 scsidev的设备名即使在设备不可用的时候也不改变。
方法: a)安装: [root@diomede /root]# tar xzf scsidev-2.22.tar.gz [root@diomede /root]# cd scsidev [root@diomede 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@diomede scsidev]# [root@diomede scsidev]# make gcc -g -O2 -Wall -DVERSION=\"2.22\" -o scsidev scsidev.c [root@diomede 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/
b)创建scsidev的设备名: [root@diomede 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"
c)得到scsidev设备: [root@diomede scsidev]# ls /dev/scsi/ nsth0-0c0i0l0 sgh0-0c0i0l0 sgh0-0c0i6l0 sth0-0c0i1l0 nsth0-0c0i1l0 sgh0-0c0i1l0 sth0-0c0i0l0
下面表格是三种设备名的对比:
--------------------------------------------------------------------------------- Native drivers Native scsidev IBM Ultrium drivers ------------ ------------ --------------- -------------- Medium changer /dev/sg[0-32] /dev/scsi/sgh0-0c0i1l0 /dev/IBMchanger[0-32] ------------ ------------ --------------- -------------- Tape device /dev/st[0-32] /dev/scsi/sth0-0c0i1l0 /dev/IBMtape[0-32] /dev/nst[0-32] /dev/scsi/nsth0-0c0i1l0 /dev/IBMtape[0-32]n /dev/sg[0-32] /dev/scsi/sgh0-0c0i1l0 ----------------------------------------------------------------------------------
2)参数的查询和修改:
linux中的LTO有两类参数,它们有不同的修改方法。
2.1)模块参数:
buffer_kbs=xxx (缓存大小in kilobytes) write_threshold_kbs=xxx (the write threshold in kilobytes) max_buffers=xxx (最大缓存数)
2.1.1)查看:
[root@diomede /etc]# dmesg (...) SCSI subsystem driver Revision: 1.00 PCI: Found IRQ 10 for device 00:10.0 scsi0 : Adaptec AIC7XXX EISA/VLB/PCI SCSI HBA DRIVER, Rev 6.2.1 <Adaptec 29160 Ultra160 SCSI adapter> aic7892: Ultra160 Wide Channel A, SCSI Id=7, 32/255 SCBs Vendor: IBM Model: ULT3580-TD1 Rev: 16E0 Type: Sequential-Access ANSI SCSI revision: 03 (scsi0:A:0): 80.000MB/s transfers (40.000MHz, offset 23, 16bit) Vendor: IBM Model: ULT3580-TD1 Rev: 16E0 Type: Sequential-Access ANSI SCSI revision: 03 (scsi0:A:1): 80.000MB/s transfers (40.000MHz, offset 23, 16bit) Vendor: IBM Model: ULT3583-TL Rev: 2.50 Type: Medium Changer ANSI SCSI revision: 02 st: Version 20011003, bufsize 262144, wrt 65536, max init. bufs 4, s/g segs 16 Attached scsi tape st0 at scsi0, channel 0, id 0, lun 0 Attached scsi tape st1 at scsi0, channel 0, id 1, lun 0 Attached scsi generic sg2 at scsi0, channel 0, id 6, lun 0, type 8 (...)
2.1.2)修改:
2.1.2.1)如果你已经将驱动编译到了内核,请修改LILO的配置文件将参数传给内核。 修改 /etc/lilo.conf文件(最后一行):
boot=/dev/hda1 map=/boot/map install=/boot/boot.b prompt timeout=50 message=/boot/message linear default=linux image=/boot/vmlinuz-2.4.13 label=linux read-only root=/dev/hda7 append="max_scsi_luns=128 st=buffer_kbs:256,write_threshold_kbs:64" 这种修改是永久生效的。
2.1.2.2)如果临时插入内核模块,请修改/etc/modules.conf文件。具体的 修改方法和修改后执行的操作,请参考驱动程序的安装步骤。
这种修改是永久生效的。
2.2)命令修改的参数:
2.2.1)查看:
2.2.1.1)使用mt命令:
[root@diomede /etc]# mt -f /dev/st0 status SCSI 2 tape drive: File number=0, block number=0, partition=0. Tape block size 1024 bytes. Density code 0x40 (unknown to this mt). Soft error count since last status=0 General status bits on (41010000): BOT ONLINE IM_REP_EN
2.2.1.2)使用tapeinfo命令:
[root@diomede /root]# tapeinfo -f /dev/sg0 Product Type: Tape Drive Vendor ID: 'IBM ' Product ID: 'ULT3580-TD1 ' Revision: '16E0' Attached Changer: No SerialNumber: '6811020764' MinBlock:1 MaxBlock:16777215 SCSI ID: 0 SCSI LUN: 0 Ready: yes BufferedMode: yes Medium Type: Not Loaded Density Code: 0x40 BlockSize: 32768 DataCompEnabled: yes DataCompCapable: yes DataDeCompEnabled: yes CompType: 0x1 DeCompType: 0x1 BOP: yes Block Position: 0
2.2.2)修改:
使用下列命令之一将修改参数: [root@diomede /root]# mt -f /dev/st0 setblk 32768 (设置块大小) [root@diomede /root]# mt -f /dev/st0 datcompression 0 (关闭压缩)
这种修改在reboot前有效。要想永久生效,最简单的方法是将此类命令 放入启动文件。
|