≡ Menu

How to Scan new LUNs on Linux with QLogic driver

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

Tweet itFacebook itGoogle+ itPDF itFound an error/typo on this page?

{ 4 comments… add one }

  • Sofian Hen Sum August 15, 2008, 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.

  • Nick Stoianov December 1, 2009, 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;

  • dwitil January 29, 2010, 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

  • dermaniac July 2, 2012, 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’

Leave a Comment