Tuesday, September 20, 2011

Dynamic SAN fabric reconfiguration

There are several methods that you can use to force the Linux operating system to recognize disks that are added or removed from the fabric.
When you add or remove disks from the fabric, you can use any of the following methods to force the Linux host to recognize these changes:
  1. Rescan the SCSI bus by restarting the host.
  2. Rescan the SCSI bus by unloading and reloading the host adapter driver.
  3. Rescan the bus by echoing the /sys filesystem (Linux 2.6 kernels only).
  4. Manually add and remove SCSI disks by echoing the /proc or /sys filesystem.
Because devices are discovered by scanning the SCSI bus, it is typically easiest to rescan the SCSI bus to detect any SAN fabric changes.
Rescan the bus by restarting the host or by unloading and reloading the host adapter driver
A bus rescan is automatically triggered by restarting the system or reloading the host adapter driver.
Reloading the host adapter driver assumes that the host adapter driver is built as a module. Restarting the system works whether the driver is compiled in the kernel or as a module.
Before performing these tasks, you must:
  1. Stop all I/O.
  2. Unmount all file systems.
  3. 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, reload SDD with the sdd start command.
Rescan the bus by echoing the /sys filesystem
For Linux 2.6 kernels only, a rescan can be triggered through the /sys interface without having to unload the host adapter driver or restart the system. The following command scans all channels, targets, and LUNs on host H.
echo “- - -” > /sys/class/scsi_host/hostH/scan
Manually add and remove SCSI disks by echoing the /proc or /sys filesystem
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.

0 comments :

Post a Comment