Howto: Linux see new fiber channel attached disk LUNs without rebooting

Q. How do I force fdisk to see new fiber channel attached disk LUNs without rebooting my Linux server or system?

ADVERTISEMENTS

A. Hot swapping or hot plugging is the ability to remove and replace components of a machine, usually a computer, while it is operating. Once the appropriate software is installed on the computer, a user can plug and unplug the component without rebooting.

You can add new SCSI device to a Linux system through SCSI hotplug mechanism.

Type the following command as root user:

$ echo "scsi add-single-device 1 2 3 4">/proc/scsi/scsi

Where,

  • 1 – HBA number
  • 2 – channel id on the HBA
  • 3 – SCSI ID of the new device
  • 4 – LUN of the new device

You need to replace 1,2,3,4 with actual values or parameters as per above list.

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
4 comments… add one
  • Harold Veatch Sep 4, 2006 @ 3:13

    A cautionary note. I found that using the posted command to bring a Quantum SDLT scsi tape drive on line if it went off line for some reason, would cause it to negotiate at a lower than maximum trasfer speed. I don’t know if this happens with other devices or why it happens. The way I got around it was to reload the driver (asumming a klm).

    av

  • Hector De Jesus Oct 24, 2006 @ 19:11

    A better alternative is to use the utility from q-logic “ql-dynamic-tgt-lun-disc-1.8.tgz”

  • Davinder Nov 21, 2009 @ 1:32

    * 1 – HBA number
    * 2 – channel id on the HBA
    * 3 – SCSI ID of the new device
    * 4 – LUN of the new device

    how we will get these information from system. pls give more clarity on this part.

  • Nick Stoianov Dec 1, 2009 @ 6:10

    You can try the script I wrote below:

    #!/usr/bin/perl

    #####################################################################
    #
    # Quick Perl Script to scan for Fiber LUNs without restarting Linux
    #
    #####################################################################

    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;

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.