General
cancel
Showing results for 
Search instead for 
Did you mean: 

Performing a linux rescan of newly added LUNS

Paul Thomson_2
Super Advisor

Performing a linux rescan of newly added LUNS

Hi

I have read a number of posts on the qlogic website and internet in general about getting newly added luns recognised without a reboot. I have tried running the hp_fibreutils hp_rescan / xpinfo / and found a decent post advising the following

Question

Can devices be rescanned in Linux OS without reloading the Linux driver?

A new LUN was added to the storage, but the LUN cannot be seen by the driver or the OS. Rebooting or reloading the driver would be too disruptive.
Answer

There is a procedure which forces the driver to rescan the targets to allow a new device to be added. This triggers the driver to initiate a LUN discovery process.

To force a rescan from the command line, type the following command:
# echo "scsi-qlascan" > /proc/scsi//

Where:
- = qla2100, qla2200, qla2300 (2.4 kernel drivers) or qla2xxx (2.6 kernel drivers)
- = the instance number of the HBA

After executing this command, force the SCSI mid layer to do its own scan and build the device table entry for the new device by typing the following command:
# echo "scsi add-single-device 0 1 2 3" >/proc/scsi/scsi

Where:
- "0 1 2 3" = your "Host Channel ID LUN"

The scanning must be done in the above mentioned order: first the driver (qla2300/qla2200 driver, etc.), and then the Linux SCSI mid layer (i.e. OS scan).
Operating System
Linux Red Hat
Linux SUSE

I can try this but dont know how to find the HOST / Channel / ID / LUN
of the new luns.

The storage guys have added 4 new luns and /proc/scsi/scsi shows 77 disks, but /proc/scsi/qla2xxx/0 shows 73 so it seems the scsi layer sees them, but not the qlogic card correctly.

Im using the 2.6.9-11 kernel on redhat.
Argh ye land lovers !
9 REPLIES
Ivan Ferreira
Honored Contributor

Re: Performing a linux rescan of newly added LUNS

There is a script that handles /proc/scsi/scsi, and it's called rescan-scsi-bus.sh.

Normally, hp_rescan should do the job.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Rob Leadbeater
Honored Contributor

Re: Performing a linux rescan of newly added LUNS

Hi,

You may well be able to pick up the relevant information in the output of "dmesg"

Failing that, the commands "lssd" and "lssg" may be of use...

Hope this helps,

Regards,

Rob
Hemmetter
Esteemed Contributor

Re: Performing a linux rescan of newly added LUNS

Hi Paul

you can trigger a scsi-bus rescan by sending string "- - - " to the file named "scan" placed in /sys/class/scsi_host/hostX/

$ cd /sys/class/scsi_host/hostX/
# where hostX is your qla
# maybe file hostX/proc_name is helpful to # identify the correct one.

then:
$ echo "- - - " > scan
and
$ dmesg | tail
or
cat /proc/scsi/scsi

hope this helps.
rgds
HGH


skt_skt
Honored Contributor

Re: Performing a linux rescan of newly added LUNS

you may download the qlun_disc.sh from qlogic's web site.

This script is a command utility, which will help to Perfom the followings

QLogic Linux LUN Scan Utility v2.3

To begin scanning the LUNs issue following command:

# /opt/local/unix/bin/qlun_disc.sh

Usage: /opt/local/unix/bin/qlun_disc.sh [OPTIONS]

-cl, --current-luns
Displays LUNS currently present

-h, --help, ?
Prints this help message

-i, --interactive
Use this option to use the menu driven program

-p, --proc
Use PROC file system for LUN scanning

-r, --refresh
To refresh, that is remove LUNs that are lost
use the options "-r|--refresh". This will
remove the LUNs which no more exist.

-s, --scan [-r|--refresh]
The QLogic LUN scan utility re-scans all the
devices connected to the QLogic HBA
TY 007
Honored Contributor

Re: Performing a linux rescan of newly added LUNS

Hello Paul,

>> echo "scsi-qlascan" > /proc/scsi//
>> echo "scsi add-single-device 0 1 2 3" >/proc/scsi/scsi

Theoritically above commands are safe. If involves Production Server, do consider carefully, worst scenario - Kernel Panic :)

Thanks
TY 007
Honored Contributor

Re: Performing a linux rescan of newly added LUNS

Hello Paul,

>> echo "scsi-qlascan" > /proc/scsi//
>> echo "scsi add-single-device 0 1 2 3" >/proc/scsi/scsi

Try not to issue above command while SAN Backup (NetBackup, Data Protector) is running. There are possibilities that the SAN Backup could be interrupted.

Thanks
Paul Thomson_2
Super Advisor

Re: Performing a linux rescan of newly added LUNS

Hi I have tried these and with variations they do work so thanks to everyone. By this I can dynamically add the LUNS without reboot and then format them.

However, via SANsurfer we are using the following settings in /etc/modprobe.conf
options qla2xxx ConfigRequired=1 ql2xmaxqdepth=16 qlport_down_retry=30 ql2xlogi
nretrycount=16 ql2xfailover=1 ql2xlbType=1 ql2xautorestore=0x80

In order to get the Qlogic cards to register the new LUNS in SANsurfer I need to reboot. I am currently asking HP about this because if the LUNS are not visible in SANsurfer, if my primary fibre card failed and all luns used the failover card would the new LUNS be usable ?

Any thoughts ?
Argh ye land lovers !
skt_skt
Honored Contributor

Re: Performing a linux rescan of newly added LUNS


SAN surfer is a swicth manager s/w(if is understand right) and does not replace the path fail over s/w like power path module

What software do you use for path fail over facility?So what SANsurfer could not see is some thing different(asuume not related)to how the path management s/w responds to a fiber card failure.
mike_Stephen
Occasional Visitor

Re: Performing a linux rescan of newly added LUNS

Hi,

I noticed that when removing a scsi LUN from the array without rebooting, after rescan, it is still showing up in /proc/scsi/scsi, it this the correct Linux behavior or something to do with qla2xxx driver or a bug, is the driver supposing to inform scsi mid layer about this removal and scsi mid layer will update its own LUN list or not?

Thanks for the information.