Using Google Chrome?

Download my
free Chrome Extension, Power Notes Searcher, to make searching for and evaluating SAP notes, much easier.

Recent Posts

Thursday, April 11, 2013

HP MSL 2024 LTO Tape Library on Oracle Enterprise Linux 5.7 (RHEL 5.7)

Print Friendly and PDF
Whilst working on a HP ProLiant ML370 G6 server running Linux kernel 2.6.18 (Oracle Enterprise Linux 5.7), I was trying to get the O/S to see an HP MSL 2024 LTO-4 tape drive and library.

After a reboot, there was still no sign of the “st” device in /dev:

> ls -l /dev/st[0-9]*


And no SCSI device listed other than the DVDROM:

> cat /proc/scsi/scsi

Attached devices:
Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: hp Model: DVDROM DH40N Rev: IS01
Type: CD-ROM ANSI SCSI revision: 05


I found the following “page” very helpful:
https://www.kernel.org/doc/Documentation/blockdev/cciss.txt

It mentioned the HP Smart Array driver, also known as cciss.
I checked I had one of these puppies:

> lspci |grep Array
05:00.0 RAID bus controller: Hewlett-Packard Company Smart Array G6 controllers (rev 01)
1b:00.0 RAID bus controller: Hewlett-Packard Company Smart Array G6 controllers (rev 01)


Yep, I had two.
I checked the Kernel module for cciss was loaded:

> lsmod | grep cciss
cciss 125033 3
scsi_mod 199129 12 be2iscsi,ib_iser,iscsi_tcp,bnx2i,libcxgbi,libiscsi2,scsi_transport_iscsi2,sr_mod,sg,libata,cciss,sd_mod


Yep, it was loaded.
Also notice that the scsi_mod has 12 modules referenced.

So my problem was probably like the “page” I pointed out suggested:

Additionally, note that the driver will not engage the SCSI core at init
time. The driver must be directed to dynamically engage the SCSI core via
the /proc filesystem entry which the "block" side of the driver creates as
/proc/driver/cciss/cciss* at runtime. This is because at driver init time,
the SCSI core may not yet be initialized (because the driver is a block
driver) and attempting to register it with the SCSI core in such a case
would cause a hang. This is best done via an initialization script
(typically in /etc/init.d, but could vary depending on distribution).

Note the words “dynamically engage”.
They are not written like that for fun. Guess what was required? Yep, I need to engage the SCSI core:

> ls -l /proc/driver/cciss
-rw-r--r-- 1 root root 0 Mar 15 14:16 cciss0
-rw-r--r-- 1 root root 0 Mar 15 14:16 cciss1

> echo "engage scsi" > /proc/driver/cciss/cciss0
> echo "engage scsi" > /proc/driver/cciss/cciss1


Now load the “st” tape module into the Kernel:

> modinfo st
filename: /lib/modules/2.6.18-274.0.0.0.1.el5/kernel/drivers/scsi/st.ko
alias: char-major-9-*
license: GPL
description: SCSI tape (st) driver
author: Kai Makisara
srcversion: AA839FAA66A7758BC7A5C9D
depends: scsi_mod
vermagic: 2.6.18-274.0.0.0.1.el5 SMP mod_unload gcc-4.1
parm: buffer_kbs:Default driver buffer size for fixed block mode (KB; 32) (int)
parm: max_sg_segs:Maximum number of scatter/gather segments to use (256) (int)
parm: try_direct_io:Try direct I/O between user buffer and tape drive (1) (int)
parm: try_rdio:Try direct read i/o when possible (int)
parm: try_wdio:Try direct write i/o when possible (int)
module_sig: 883f3504e2dbc6ac74ff6cf7d76a7e6112d2d09e302b4a8f57e42688cd5258668b7a3044163799609e32cd3dacb7e842b9a84ef2d2032f542f69e866

> insmod /lib/modules/2.6.18-274.0.0.0.1.el5/kernel/drivers/scsi/st.ko


Check that it’s loaded:

> lsmod | grep st
st 72805 0
scsi_mod 199129 13 st,be2iscsi,ib_iser,iscsi_tcp,bnx2i,libcxgbi,libiscsi2,scsi_transport_iscsi2,sr_mod,sg,libata,cciss,sd_mod


You will see on the above output that the scsi_mod now has accessed the “st” module (in the list) and shows 13 (yours maybe different) modules.

Check we have a SCSI device:

> cat /proc/scsi/scsi
Attached devices:
Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: hp Model: DVDROM DH40N Rev: IS01
Type: CD-ROM ANSI SCSI revision: 05
Host: scsi3 Channel: 00 Id: 00 Lun: 00
Vendor: HP Model: Ultrium 4-SCSI Rev: U55W
Type: Sequential-Access ANSI SCSI revision: 05
Host: scsi3 Channel: 00 Id: 00 Lun: 01
Vendor: HP Model: MSL G3 Series Rev: 5.50
Type: Medium Changer ANSI SCSI revision: 05


Bingo!

We can confirm what DMESG sees:

> dmesg | tail
scsi2 : cciss
scsi3 : cciss
Vendor: HP Model: Ultrium 4-SCSI Rev: U55W
Type: Sequential-Access ANSI SCSI revision: 05
st 3:0:0:0: Attached scsi tape st0
st0: try direct i/o: yes (alignment 512 B)
st 3:0:0:0: Attached scsi generic sg1 type 1
Vendor: HP Model: MSL G3 Series Rev: 5.50
Type: Medium Changer ANSI SCSI revision: 05
scsi 3:0:0:1: Attached scsi generic sg2 type 8
st0: Block limits 1 - 16777215 bytes.


And there at the end is the confirmation that we should now have a /dev/st0 device:

> ls -l /dev/st0
crw-rw---- 1 root disk 9, 0 Mar 15 12:50 /dev/st0


With a tape confirmed as in the tape drive (through the web based HP MSL tape library web GUI), we can do a basic backup using TAR:

> echo "Hello Darryl" > /tmp/dmg.txt
> tar -cvf /dev/st0 /tmp/dmg.txt


Or to not rewind the tape after, we could use nst0:
> tar -cvf /dev/nst0 /tmp/dmg.txt

Then read the file back from the tape device:

> rm /tmp/dmg.txt
> tar -tvf /dev/st0
-rw-r--r-- root/root 13 2013-03-15 14:54:20 tmp/dmg.txt

> tar -xvf /dev/st0 tmp/dmg.txt

No comments: