Thank you for visiting this page, this page has been update in another link Sysfs fibre channel tools updated for RHE6
I'm not doing something brand new here. It's a FC tool set I've been using for many years, very useful, just updated to reflect RHEL6 latest kernel. Tested on kernel2.6.32-358.14, using Emulex and Qlogic cards. Should be good for other types of HBA too, just add vendor info to ls_fc_luns You can still download its origional version from the link below, but won't work for your RHEL6 http://dims.ncsa.illinois.edu/set/san/src/sysfs_fc_tools.tgz Scripts to simplify attaching, displaying, deleting fibre channel luns using 2.6 kernel sysfs features. It includs 4 scripts: lip_fc_hosts ls_fc_luns scan_fc_luns delete_fc_luns Here are useage examples: lip_fc_hosts Send lip to all local FC HBAs. # ./lip_fc_hosts + [[ -f /sys/class/fc_host/host5/issue_lip ]] + echo 1 + 1> /sys/class/fc_host/host5/issue_lip + [[ -f /sys/class/fc_host/host6/issue_lip ]] + echo 1 + 1> /sys/class/fc_host/host6/issue_lip scan_fc_luns Scan all local FC HBAs for new luns and present them to the kernel. ./scan_fc_luns ls_fc_luns List HBA WWPN, target WWPN, kernel device name, scsi H:B:T:L tuple and scsi_id for all fibre channel luns. # ./ls_fc_luns HBA 0x21000024ff3434e4 host5 0x21000024ff3434e4 0x20370080e52d2652 5:0:0:0 sdb 360080e50002d26520000067a4f7a3fb8 30 0x21000024ff3434e4 0x20370080e52d2652 5:0:0:1 sdc 360080e50002d2124000006d14f7a3f92 30 0x21000024ff3434e4 0x20370080e52d2652 5:0:0:10 sdl 360080e50002d26520000068e4f7a4022 30 0x21000024ff3434e4 0x20370080e52d2652 5:0:0:11 sdm 360080e50002d2124000006e54f7a3ffe 30 0x21000024ff3434e4 0x20370080e52d2652 5:0:0:2 sdd 360080e50002d26520000067e4f7a3fcc 30 0x21000024ff3434e4 0x20370080e52d2652 5:0:0:3 sde 360080e50002d2124000006d54f7a3fa6 30 delete_fc_luns Delete (detach) all fibre channel luns from the system. ./delete_fc_luns + fn=/sys/class/scsi_host/host5/device/subsystem/devices/5:0:0:0/delete + [[ -f /sys/class/scsi_host/host5/device/subsystem/devices/5:0:0:0/delete ]] + echo 1 + 1> /sys/class/scsi_host/host5/device/subsystem/devices/5:0:0:0/delete + fn=/sys/class/scsi_host/host5/device/subsystem/devices/5:0:0:1/delete + [[ -f /sys/class/scsi_host/host5/device/subsystem/devices/5:0:0:1/delete ]] + echo 1 + 1> /sys/class/scsi_host/host5/device/subsystem/devices/5:0:0:1/delete Requires Linux 2.6 Kernel and sysfs pseudo-filesystem. How to get Vendor code? here you go. Once yoou have the vendor code for different type of HBA card, then add it to ls_fc_lun function get_hba_wwpn or drop me an e-mail. # lspci -nvms 15:00.0 Device: 15:00.0 Class: 0c04 Vendor: 1077 Device: 2532 SVendor: 1077 SDevice: 015d PhySlot: 2 Rev: 02 For how to get HBA pci info, see the link below https://sites.google.com/site/itmyshare/storage/how-to-install-check-upgrade-and-remove-hba-card-in-linux-rhel6 More technical details: echo "1" > /sys/class/fc_host/host/issue_lip This operation performs a Loop Initialization Protocol (LIP) and then scans the interconnect and causes the SCSI layer to be updated to reflect the devices currently on the bus. A LIP is, essentially, a bus reset, and will cause device addition and removal. This procedure is necessary to configure a new SCSI target on a Fibre Channel interconnect. Bear in mind that issue_lip is an asynchronous operation. The command may complete before the entire scan has completed. You must monitor /var/log/messages to determine when it is done. Currently only the lpfc and qla2xxx drivers support issue_lip. echo "- - -" > /sys/class/scsi_host/hosth/scan The older form of this command, echo "scsi add-single-device 0 0 0 0" > /proc/scsi/scsi, is deprecated, however it still works on RHEL6. The recommended command to use is echo "c t l" > /sys/class/scsi_host/hosth/scan where h is the HBA number, c is the channel on the HBA, t is the SCSI target ID, and l is the LUN. In this case, however, the channel number, SCSI target ID, and LUN values are replaced by wildcards. Any combination of identifiers and wildcards is allowed, allowing you to make the command as specific or broad as needed. This procedure will add LUNs, but not remove them. echo 1 > /sys/class/scsi_device/h:c:t:l/device/delete The older form of these commands, echo "scsi remove-single-device 0 0 0 0" > /proc/scsi/scsi, is deprecated, however it still works on RHEL6. The recommended command to use is echo 1 > /sys/class/scsi_device/h:c:t:l/device/delete where h is the HBA number, c is the channel on the HBA, t is the SCSI target ID, and l is the LUN. You can determine the device-name, HBA number, HBA channel, SCSI target ID and LUN for a device from various commands, such as lsscsi, scsi_id, multipath -l, and ls -l /dev/disk/by-*. |