Difficulty: Intermediate | Prerequisites: Basic Linux command line, familiarity with storage concepts (SCSI, Fibre Channel), kernel modules.
In enterprise Linux environments, storage is often presented to servers over a SAN (Storage Area Network) using the SCSI or Fibre Channel protocol. When a storage administrator provisions a new LUN (a slice of disk from the SAN), the Linux server needs to discover it. Traditionally this meant rebooting, which is unacceptable on production systems. These notes cover the three standard methods for detecting new LUNs at runtime, without any downtime. You should already be comfortable navigating /sys and /proc and understand the basics of how Linux represents hardware through these virtual filesystems.
Linux can detect newly provisioned SAN storage without rebooting by rescanning the SCSI/FC bus through sysfs, by unloading and reloading the HBA driver module, or by running an automated rescan script. The first method is the most common in production. All three require root privileges.
LUN (Logical Unit Number)
A logical reference to a portion of a storage subsystem, typically a virtual disk carved from a SAN array. Think of it as the address label on a specific chunk of shared storage that a server is allowed to use.
SCSI (Small Computer System Interface)
A set of standards for physically connecting and transferring data between computers and peripheral devices, particularly storage. In modern contexts it usually refers to the protocol layer rather than the physical cable.
Fibre Channel (FC)
A high-speed network technology used to connect servers to shared storage arrays in a SAN. In simple terms, it is the "highway" that carries SCSI commands between your server and the storage.
HBA (Host Bus Adapter)
The physical card (or virtual adapter) in a server that connects it to the Fibre Channel fabric. Think of it as the server's network card, but for storage traffic instead of Ethernet.
SAN (Storage Area Network)
A dedicated high-speed network that provides block-level access to shared storage. In simple terms, it is the infrastructure that lets many servers share the same pool of disks.
sysfs (/sys)
A virtual filesystem in Linux that exposes information about devices, drivers, and kernel subsystems as a hierarchy of files and directories. Writing to certain files in /sys triggers kernel actions, such as rescanning for new devices.
issue_lip (Loop Initialization Primitive)
A Fibre Channel operation that reinitialises the link between the HBA and the fabric, forcing rediscovery of targets. Think of it as telling the HBA to "reconnect and look around for new storage."
modprobe
A Linux utility for adding and removing kernel modules (drivers). It handles dependencies automatically, unlike the lower-level insmod.
This is the most widely used approach in production because it is non-disruptive and targets only the scan operation.
First, identify which SCSI host adapters are present:
ls /sys/class/scsi_host
This lists host0, host1, etc., each representing an HBA port or virtual adapter.
Issue a LIP (Loop Initialization Primitive) on each FC host to force the fabric to refresh:
echo 1 > /sys/class/fc_host/host0/issue_lip
echo 1 > /sys/class/fc_host/host1/issue_lip
Repeat for every FC host adapter listed.
Trigger a SCSI bus rescan on each host:
echo "- - -" > /sys/class/scsi_host/host0/scan
echo "- - -" > /sys/class/scsi_host/host1/scan
The three hyphens separated by spaces (- - -) are wildcards representing channel, target ID, and LUN. Using wildcards tells the kernel to scan all channels, all targets, and all LUNs.
After scanning, verify with lsblk, fdisk -l, or cat /proc/scsi/scsi to confirm the new device appears.
This unloads the Fibre Channel driver entirely, then reloads it, which forces a full rediscovery. It is more disruptive than Option 1 because it briefly removes all devices attached through that driver.
Remove the driver module:
modprobe -r qla2300
qla2300 is the QLogic FC HBA driver. Replace with the correct driver name for your hardware (e.g., lpfc for Emulex).
Verify the module is fully unloaded:
lsmod | grep qla
If this returns nothing, the module is gone.
Reload the driver:
modprobe qla2300
The kernel re-initialises the HBA and discovers all currently presented LUNs from scratch.
This method is best reserved for situations where the sysfs rescan does not pick up the new device, or when you suspect the driver state is inconsistent.
rescan-scsi-bus.sh)Kurt Garloff's rescan-scsi-bus.sh script (also packaged as sg3_utils on many distributions) automates Option 1 and adds logic for detecting removed devices as well as new ones.
The script iterates over all SCSI host adapters and scans every combination of channel, target ID, and LUN.
It uses the scsi add-single-device mechanism via /proc/scsi/scsi to register newly found devices.
With the -r flag it also removes devices that have disappeared (useful after SAN-side deprovisioning).
Key flags:
-l scans LUNs 0 through 7 (default is LUN 0 only)
-w widens the target ID scan to 0 through 15
-c scans channels 0 and 1
-r enables removal of devices no longer present
--hosts=LIST limits the scan to specific host adapters
--color adds colour-coded output (NEW, OLD, DEL)
On modern distributions, install via the package manager: yum install sg3_utils or apt install sg3-utils, then run rescan-scsi-bus.sh.
The wildcard scan string:
echo "- - -" > /sys/class/scsi_host/hostN/scan
^ ^ ^
| | |
| | LUN (- = all)
| Target ID (- = all)
Channel (- = all)
To scan only a specific device (e.g., channel 0, target 5, LUN 3):
echo "0 5 3" > /sys/class/scsi_host/host0/scan
These techniques are everyday tasks for Linux system administrators managing servers connected to SAN storage in data centres. When a storage team carves out a new volume for a database server or provisions additional capacity for a virtual machine host, the Linux admin uses one of these methods to make the OS see the new disk, typically without any application downtime. This is especially critical in environments running 24/7 workloads where a reboot window may not be available for days or weeks.
Students often assume a reboot is always needed after SAN-side changes. It is not. The kernel's SCSI subsystem supports runtime discovery through sysfs and procfs.
Some students think the "- - -" wildcard scan string uses three literal hyphens with no spaces. The spaces are mandatory. Each hyphen is a separate wildcard for channel, target, and LUN.
Reloading the HBA driver (Option 2) is sometimes treated as the default approach. It should be a fallback, not the first choice, because it temporarily removes all devices on that HBA, which can disrupt active I/O.
Students sometimes confuse /sys/class/fc_host/ (Fibre Channel host, for issuing LIPs) with /sys/class/scsi_host/ (SCSI host, for triggering scans). These are different sysfs paths serving different purposes and both are needed in an FC environment.
⚠️ Know the exact sysfs paths: /sys/class/fc_host/hostN/issue_lip for the LIP and /sys/class/scsi_host/hostN/scan for the rescan. These are commonly tested.
⚠️ Understand the meaning of the three fields in the scan string (channel, target, LUN) and that - is the wildcard for each.
⚠️ Be able to explain why Option 2 (driver reload) is more disruptive than Option 1 (sysfs rescan).
⚠️ Remember that rescan-scsi-bus.sh is the standard automated tool and ships with sg3_utils.
True or False: You must reboot a Linux server to detect a newly provisioned LUN from a SAN.
A: False. The SCSI subsystem supports runtime rescanning via sysfs.
Fill in the blank: The command echo "- - -" > /sys/class/scsi_host/host0/scan uses three wildcards representing ______, ______, and ______.
A: Channel, target ID, and LUN.
True or False: modprobe -r qla2300 loads the QLogic Fibre Channel driver.
A: False. The -r flag removes (unloads) the module.
Fill in the blank: To force a Fibre Channel HBA to re-initialise its link and rediscover targets, you write to the ______ file in sysfs.
A: issue_lip
Q: A storage administrator has provisioned a new 500 GB LUN to your Linux server over Fibre Channel. Describe the least disruptive method to make the OS detect it.
A: Issue a LIP on each FC host adapter (echo 1 > /sys/class/fc_host/hostN/issue_lip), then trigger a SCSI bus rescan (echo "- - -" > /sys/class/scsi_host/hostN/scan) for each host. Verify the new device appears with lsblk or cat /proc/scsi/scsi.
Q: Why should you avoid using the modprobe driver reload method as a first resort?
A: Unloading the HBA driver with modprobe -r temporarily removes all storage devices attached through that driver. Any active I/O on those devices will be disrupted. The sysfs rescan method is non-disruptive and should be tried first.
Q: What does the -r flag do when passed to rescan-scsi-bus.sh?
A: It enables removal of devices that are no longer present on the SCSI bus. Without -r, the script only looks for new devices and does not clean up stale entries.
Q: You run echo "- - -" > /sys/class/scsi_host/host0/scan but no new device appears. What are two possible next steps?
A: First, check that the LIP was issued (echo 1 > /sys/class/fc_host/host0/issue_lip) and that the storage team has confirmed the LUN is properly zoned and masked to the server. If the sysfs method still fails, try reloading the HBA driver as a fallback (modprobe -r ).
Q: Explain the difference between /sys/class/fc_host/ and /sys/class/scsi_host/ in this context.
A: /sys/class/fc_host/ exposes Fibre Channel-specific attributes and operations, including issue_lip for link reinitialisation. /sys/class/scsi_host/ exposes the SCSI layer, including the scan file used to trigger device discovery. In an FC-attached storage setup, you typically use both: the FC path to refresh the fabric link, and the SCSI path to scan for new devices.
This material connects directly to Linux device management and the /sys and /proc virtual filesystems. Understanding sysfs writes as a mechanism for kernel interaction is fundamental to device management, network configuration, and performance tuning across Linux administration.
LUN management also ties into multipathing (dm-multipath). Once a new LUN is detected on multiple HBA paths, the multipath daemon needs to recognise and group those paths, which is the natural next step after the scan covered here.
For virtualisation students, the same SCSI rescan principles apply when hot-adding virtual disks to a VM running on KVM, VMware, or Hyper-V.
LUN detection, SCSI rescan, Fibre Channel rescan, hot-add disk Linux, sysfs scan, issue_lip, modprobe HBA, rescan-scsi-bus.sh, sg3_utils, SAN LUN provisioning, SCSI bus scan without reboot, Linux storage administration, qla2300, lpfc, echo scan scsi_host, dynamic device discovery Linux, /proc/scsi/scsi, scsi add-single-device