Hot-Adding SAN lun to Linux (RH with Qlogic drivers)
cat /proc/scsi/qla2xxx/$Z” where Z represents the SCSI interface the Qlogic has taken for itself, you’ll get something like this:
<Snip>
.
.
</Snip>
SCSI LUN Information:
(Id:Lun) * – indicates lun is not registered with the OS.
( 0: 0): Total reqs 63185608, Pending reqs 0, flags 0x2, 0:0:81 00
Assuming you’ve just added the next LUN, in our case, LUN1, after reboot you would get an additional line below such as:
( 0: 1): Total reqs 1923, Pending reqs 0, flags 0x2, 0:0:81 00
However, on a production server we want to add this line without a reboot.
To achieve this goal, we need to run the following command:
“echo “scsi-qlascan” > /proc/scsi/qla2xxx/$Z” where $Z represents, like before, the SCSI interface.
Then you get the additional line(s) in the file. Now you should help your Linux see them (and attach a module to them). You can do it by using the following convention (taken from here): Using “dmesg“.
you can obtain the required details for the next stage: Controller, Channel, Target and LUN. Example:
Host: scsi2 Channel: 00 Id: 00 Lun: 01
Vendor: IBM Model: 1742 Rev: 0520
Type: Direct-Access ANSI SCSI revision: 03
Obtain the following details:
Controller=2 (scsi2)
Channel=0 (Channel: 00)
Target=0 (Id: 00)
LUN=1 (Lun: 01)
We will ask Linux nicely to reattach the device. Replace the descriptors with the numeric values
“echo “scsi add-single-device Controller Channel Target LUN” > /proc/scsi/scsi”
In our example: “echo “scsi add-single-device 2 0 0 1” > /proc/scsi/scsi”
To remove a device prior to unmapping it from the SAN, replace add-single-device with “remove-single-device”.
This post’s Qlogic discovery was the insight of a friend of mine, and the credit is his 🙂
I have demonstrated how to hot-add LUNs to a Linux system with Qlogic HBA. This has become irrelevant with the newer method, available for RHEL4 Update 3 and above.The new method is as follow:echo 1 > /sys/class/fc_host/host/issue_lipecho &