Posts Tagged ‘qlogic’

Re-scan SCSI bus for Qlogic Card

Thursday, September 9th, 2010

Short Story: With Qlogic driver you can use:

#> echo "scsi-qlascan" > /proc/scsi/qla2300/3 (or your device/port)

Must do for every port (if you have installed or balanced across ports), also this is with a qlogic driver, YMMV, also your numbers under the /proc/scsi/qla2xxx/ (or whatever your version is) will probably vary.

Long Story: Sorry for the hiatus, been on vacation then got back and simultaneously had a tape library install and virtual tape library install. So during the VTL install there was a bit of a hiccup on the main backup server seeing the scsi devices that we presented from the VTL setup (over Fibre of course ;)). *Now I am in the process of replacing the backup server (which is a hyper-threaded P4 w/6GB of RAM with a Dual Quad Core w/32GB or RAM and a metric ton of disk space – for restores and such). Any whos, so we needed the HBA to rescan the bus, and with the QLogic driver you can do the following (for as many ports as you have):

So on my system (the qla2342 is the HBA (yes old I know) with QLogic driver installed) when I do an ls on the /proc/scsi dir I get the following:

[Mon Jun 28 @ 22:45:27] # ls -CF /proc/scsi/ megaraid/ mptscsih/
qla2300/ scsi sg/

Since we know that the HBA is of the qlogic variety we then ls on the /proc/scsi/qla2300 dir:

[Mon Jun 28 @ 22:48:02] # ls -CF /proc/scsi/qla2300/ 3 4 HbaApiNode

so if I then cat /proc/scsi/qla2300/3 it returns (this is only partial output)

[Mon Jun 28 @ 22:49:10] # cat /proc/scsi/qla2300/3 QLogic 
PCI to Fibre Channel Host Adapter for QLA2342: Firmware 
version: 3.03.19, Driver version 7.07.06 Entry address = 
f8c82060 HBA: QLA2312 , Serial# Q20331 Request Queue =
0x36ce0000, Response Queue = 0x36cd0000 Request 
Queue count= 512, Response Queue count= 512 Total number of 
active commands = 1 Total number of interrupts = 679679694 Total number 
of active IP commands = 0 <...> Commands retried with dropped 
frame(s) = 0 Configured characteristic impedence: 50 ohms 
Configured data rate: 1-2 Gb/sec auto-negotiate <...>
[Mon Jun 28 @ 22:55:02] # echo "scsi-qlascan" >/proc/scsi/qla2300/3

And that will force the scsi bus rescan. For those that are interested we also had to add the devices manually, which if you’ve never done is fairly interesting. Here is how we did it for the devices on 3. After running the bus rescan the devices showed up starred (*) in /proc/scsi/qla2300/3 (which meant they weren’t yet registered, the server saw them just fine, now to add them), looking in the file they showed up (I am writing this post install so they are now registered, but the * shows up after the flags – so flags 0×0*):

SCSI LUN Information: (Id:Lun) * - indicates lun is not registered with
the OS. <...> (10: 0): Total reqs 5056, Pending reqs 0, flags 0x0,
0:0:8b, (10: 1): Total reqs 31, Pending reqs 0, flags 0x0, 0:0:8b, (10:
2): Total reqs 31, Pending reqs 0, flags 0x0, 0:0:8b, (10: 3): Total
reqs 5, Pending reqs 0, flags 0x0, 0:0:8b, (10: 4): Total reqs 5,
Pending reqs 0, flags 0x0, 0:0:8b,

So you would then add each device:

echo 'scsi add-single-device 3 0 10 0' > /proc/scsi/scsi 
echo 'scsi add-single-device 3 0 10 1' > /proc/scsi/scsi 
echo 'scsi add-single-device 3 0 10 2' > /proc/scsi/scsi 
echo 'scsi add-single-device 3 0 10 3' > /proc/scsi/scsi 
echo 'scsi add-single-device 3 0 10 4' > /proc/scsi/scsi

Here’s the snippet from the SCSI programming Howto:

Direct Link applicable section.

If a newer kernel and the /proc file system is running, a non-busy device can be removed and installed ‘on the fly’.

To remove a SCSI device:

echo "scsi remove-single-device a b c d" > /proc/scsi/scsi

and similar, to add a SCSI device, do:

echo "scsi add-single-device a b c d" > /proc/scsi/scsi

where a == hostadapter id (first one being 0) b == SCSI channel on hostadapter (first one being 0) c == ID d == LUN (first one being 0) So in order to swap the /dev/sgc and /dev/sgd mappings from the previous example, we could do:

echo "scsi remove-single-device 0 0 4 0" > /proc/scsi/scsi 
echo "scsi remove-single-device 0 0 5 0" > /proc/scsi/scsi 
echo "scsi add-single-device 0 0 5 0" > /proc/scsi/scsi 
echo "scsi add-single-device 0 0 4 0" > /proc/scsi/scsi

since generic devices are mapped in the order of their insertion.

Hope this helps! Till next time, be kind, share and enjoy.

Meta:
Contact:
Scott:
Systems Administrator, Geek, Horror fan.

Ways to reach Scott:
Twitter
FriendFeed
Facebook
LinkedIn
Tumblr
Zerply
About.me

Barry:
Systems Administrator / Geek.

Ways to reach Barry:
Twitter
Friendfeed
Associations:
Twitter:

View more tweets | Powered by HL Twitter