SAN - Storage reconfig in Linux

Dynamic SAN fabric reconfiguration

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:

  1. Reboot the host
  2. Unload and reload the host adapter driver
  3. Rescan the bus by echoing the /sys filesystem (only for Linux 2.6 kernels)
  4. Manually add and remove SCSI disks by echoing the /proc or /sys filesystem

1.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:

    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 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.


2.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 reboot the system. The following command will scan all channels, targets, and LUNs on host H.

echo “- - -” > /sys/class/scsi_host/hostH/scan

3. 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

0 comments:

Post a Comment

Blogger Tips and TricksLatest Tips And TricksBlogger Tricks