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
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop











{ 4 comments… read them below or add one }
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.
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;
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
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’