This section provides four methods that you can use to force the
Linux operating system to recognize disk that are added or removed from the
fabric.
When you add or remove disks to the fabric, you can use any of the following
four ways to force the Linux host to recognize these changes:
- Reboot the host
- Unload and reload the host adapter driver
- Rescan the bus by echoing the /sys filesystem (only for Linux 2.6 kernels)
- Manually add and remove SCSI disks by echoing the /proc or /sys filesystem
Reboot the Host or Unload and Reload the host adapter driver
Since devices are discovered by scanning the SCSI bus, it is typically
easiest to rescan the SCSI bus to detect any SAN fabric changes. A bus rescan
is automatically triggered by reloading the host adapter driver or by rebooting
the system.
Before unloading the host adapter driver or rebooting the host, you must:
- Stop all I/O
- Unmount all file systems
- If SDD is being used, unload the SDD driver with the sdd stop command
before reloading the host adapter driver. After the host adapter driver is
reloaded then reload SDD with the sdd start command.
Reloading the host adapter driver assumes that the host adapter driver
is built as a module. Rebooting the system works regardless of whether or
not the host adapter driver is compiled into the kernel or as a module.
Rescan the bus by echoing the /sys filesystem (only for Linux 2.6 kernels)
For Linux 2.6 kernels only, a rescan can be triggered through the /sys
interface without having to unload the host adapter driver or reboot the system.
The following command will scan all channels, targets, and LUNs on host H.
echo “- - -” > /sys/class/scsi_host/hostH/scan
Manually add and remove SCSI disks
You can use the following commands to manually add and remove SCSI disk.
Note: In
the following command examples, H, B, T, L, are the host, bus, target, and
LUN IDs for the device.
You can unconfigure and remove an unused SCSI disk with the following command:
- echo "scsi remove-single-device H B T
L" > /proc/scsi/scsi
- If the driver cannot be unloaded and loaded again, and you know the host,
bus, target and LUN IDs for the new devices, you can add them through the
/proc/scsi/scsi file using the following command:
-
- echo "scsi add-single-device H B T L"
> /proc/scsi/scsi
For Linux 2.6 kernels, devices can also be added and removed through the
/sys filesystem. Use the following command to remove a disk from the kernel’s
recognition:
- echo “1” > /sys/class/scsi_host/hostH/device/H:B:T:L/delete
-
- or, as a possible variant on other 2.6 kernels, you can use the command:
-
- echo “1” > /sys/class/scsi_host/hostH/device/targetH:B:T/H:B:T:L/delete
To reregister the disk with the kernel use the command:
- echo “B T L” > /sys/class/scsi_host/hostH/scan
Note: The Linux kernel does not assign permanent names for the fabric devices
in the /dev directory. Device file names are assigned in the order in which
devices are discovered during the bus scanning. For example, a LUN might be
/dev/sda. After a driver reload, the same LUN might become /dev/sdce. A fabric
reconfiguration might also result in a shift in the host, bus, target and
LUN IDs, which makes it unreliable to add specific devices through the /proc/scsi/scsi
file.