====== some useful commands around fibre channel ======
===== get adapters, WWN, WWPN, etc. =====
==== get FC adapters / HBAs ====
h212:~ # ls -l /sys/class/fc_host
total 0
lrwxrwxrwx 1 root root 0 3. Feb 08:45 host1 -> ../../devices/pci0000:3a/0000:3a:00.0/0000:3b:00.0/host1/fc_host/host1
lrwxrwxrwx 1 root root 0 3. Feb 08:45 host16 -> ../../devices/pci0000:3a/0000:3a:00.0/0000:3b:00.1/host16/fc_host/host16
lrwxrwxrwx 1 root root 0 3. Feb 08:45 host17 -> ../../devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host17/fc_host/host17
lrwxrwxrwx 1 root root 0 3. Feb 08:45 host18 -> ../../devices/pci0000:5d/0000:5d:00.0/0000:5e:00.1/host18/fc_host/host18
==== get adapter type ====
h212:~ # lspci | grep Fibre
3b:00.0 Fibre Channel: QLogic Corp. ISP8324-based 16Gb Fibre Channel to PCI Express Adapter (rev 02)
3b:00.1 Fibre Channel: QLogic Corp. ISP8324-based 16Gb Fibre Channel to PCI Express Adapter (rev 02)
5e:00.0 Fibre Channel: QLogic Corp. ISP2722-based 16/32Gb Fibre Channel to PCIe Adapter (rev 01)
5e:00.1 Fibre Channel: QLogic Corp. ISP2722-based 16/32Gb Fibre Channel to PCIe Adapter (rev 01)
==== get the wwn from the adapters ====
h212:~ # awk '{print "device:" substr(FILENAME, $0)" -- WWN: \"" $0"\" "}' /sys/class/fc_host/host*/port_name
device:/sys/class/fc_host/host16/port_name -- WWN: "0x2001000e1e302d35"
device:/sys/class/fc_host/host17/port_name -- WWN: "0x2100f4e9d45900ca"
device:/sys/class/fc_host/host18/port_name -- WWN: "0x2100f4e9d45900cb"
device:/sys/class/fc_host/host1/port_name -- WWN: "0x2001000e1e302d34"
==== get Port state ====
=== using systool ===
according to [[https://www.thegeekdiary.com/how-to-identify-the-hba-cardsports-and-wwn-in-rheloel/| The Geek Diary]]
* To check the available HBA ports :
# systool -c fc_host
Class = "fc_host"
Class Device = "host2"
Device = "host2"
Class Device = "host3"
Device = "host3"
* To find the WWNs for the HBA ports :
# systool -c fc_host -v | grep port_name
port_name = "0x500143802426baf4"
port_name = "0x500143802426baf6"
* To check the state of the HBA ports (online/offline) :
# systool -c fc_host -v | grep port_state
port_state = "Online"
port_state = "Online"
===== multipathing =====
==== paths & devices ====
==== multipathd commands ====
multipathd is not only the the multipath daemon itself, but also a useful command for analysing the SAN:
# multipathd --help
FIXME
===== Rescaning the SCSI bus =====
ordinarily you just use the ''rescan-scsi.sh'' command.
thus, this only reads the configuration again, but does not reinitialize the HBA.
this can be done by:
# echo "1" > /sys/class/fc_host/host/issue_lip
replacing ' with the number of the HBA.
==== manual switch off/on of HBA ====
thanks to [[https://www.veritas.com/support/en_US/article.100050716|Veritas]]
* To list available HBA ports, type:
# ls -l /sys/class/fc_host
total 0
lrwxrwxrwx. 1 root root 0 Jun 24 13:52 host28 -> ../../devices/pci0000:80/0000:80:02.0/0000:81:00.0/host28/fc_host/host28
lrwxrwxrwx. 1 root root 0 Jun 24 14:15 host29 -> ../../devices/pci0000:80/0000:80:02.0/0000:81:00.1/host29/fc_host/host29
The ''lspci'' command can be used to display the available Fibre Channel (FC) Adapters:
The Fibre Channel (FC) HBA port access on RedHat can be temporarily disabled using the unbind string against the pci-device-id bus address.
Syntax:
# echo "PCI-DEVICE-ID" > /sys/bus/pci/drivers/qla2xxx/unbind
To disconnect access for a specific PCI device (81:00:0), the sample syntax would be as follows:
# echo "0000:81:00.0" > /sys/bus/pci/drivers/qla2xxx/unbind
To display the filename & associated WWN details for all FC HBA controllers:
# awk '{print substr(FILENAME, $0)" \"" $0"\" "}' /sys/class/fc_host/host*/port_name
/sys/class/fc_host/host28/port_name "0x2001000e1ec2f9ca"
/sys/class/fc_host/host29/port_name "0x2001000e1ec2f9cb"
To display the filename & HBA port status:
# awk '{print substr(FILENAME, $0)" \"" $0"\" "}' /sys/class/fc_host/host*/port_state
/sys/class/fc_host/host28/port_state "Online"
/sys/class/fc_host/host29/port_state "Online"