How to Scan new LUNs on Linux with QLogic driver

by on April 30, 2006 · 4 comments· LAST UPDATED April 30, 2006

in

Q: I am using QLogic driver and I would like to know how do I scan new LUNs on Linux operating system?

A: You need to find out driver proc file /proc/scsi/qlaXXX. For example on my system it is /proc/scsi/qla2300/0

Once file is identified you need to type following command (login as the root user):

# echo "scsi-qlascan" > /proc/scsi/qla2300/0
# cat /proc/scsi/qla2300/0

Now use the script rescan-scsi-bus.sh new LUN as a device. Run script as follows:

# ./rescan-scsi-bus.sh -l -w –c

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 4 comments… read them below or add one }

1 Sofian Hen Sum August 15, 2008 at 8:00 am

Hi Vivek,

Thanks for the very informative info. However I’m not sure if your walkthrough above will cause the server to reboot. We have an oracle rac on the production site and its crucial if you could let us know if there will be no side effect whatsoever since oracle have a mechanism that will cause a server to reboot once there is the kernel hang for 5 second. Appreciate your advice.

Reply

2 Nick Stoianov December 1, 2009 at 6:02 am

To avoid reloading the driver – you can try the script I wrote below:

#!/usr/bin/perl

#####################################################################
#
# Quick Perl Script to scan for Fiber LUNs without restarting Linux
# Author: Nick Stoianov
#
#####################################################################

opendir(NS, “/sys/class/scsi_host”);
@ns=readdir(NS);
closedir(NS);
shift @ns;
shift @ns;
foreach $ns(@ns) {
open(DAT,”>/sys/class/scsi_host/$ns/scan”) || die(“Cannot Open File”);
print DAT “- – -”;
close(DAT);
}

exit;

Reply

3 dwitil January 29, 2010 at 1:57 pm

I use the below simple script for RHEL5 to detect new LUNS

for HOST in `ls /sys/class/scsi_host/`
do
echo ‘- – -’ > /sys/class/scsi_host/$HOST/scan
done

Reply

4 dermaniac July 2, 2012 at 8:25 am

dwitil’s suggestion worked under RHEL6. Just note that it is

echo ‘- – -’

NOT

echo ‘- – -’

so, in words:
echo ‘hyphen space hyphen space hyphen’
and NOT
echo ‘hyphen space dash space hyphen’

Reply

Leave a Comment

Tagged as:

Previous Faq:

Next Faq: