How to identify the HBA cards/ports and WWN in Linux:
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
There are several commands to determine the WWN of a Fibre Channel (FC) HBA and their status (online/offline). The post discusses few of the most commonly used methods.
Method 1
To find the HBA cards installed on your system use :
To find the HBA cards installed on your system use :
# lspci -nn | grep -i hba
07:00.0 Fibre Channel [0c04]: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA [1077:2532] (rev 02)
07:00.1 Fibre Channel [0c04]: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA [1077:2532] (rev 02)
To check the available HBA ports :
# ls -l /sys/class/fc_host
total 0
drwxr-xr-x 3 root root 0 Feb 3 2015 host2
drwxr-xr-x 3 root root 0 Feb 3 2015 host3
To find the state of HBA ports (online/offline) :
# more /sys/class/fc_host/host?/port_state
::::::::::::::
/sys/class/fc_host/host2/port_state
::::::::::::::
Online
::::::::::::::
/sys/class/fc_host/host3/port_state
::::::::::::::
Online
To find the WWN numbers of the above ports :
# more /sys/class/fc_host/host?/port_name
::::::::::::::
/sys/class/fc_host/host2/port_name
::::::::::::::
0x500143802426baf4
::::::::::::::
/sys/class/fc_host/host3/port_name
::::::::::::::
0x500143802426baf6
Method 2 : Using systool
Another useful command to find the information about HBAs is systool. If not already install, you may need to install the sysfsutils package.
Another useful command to find the information about HBAs is systool. If not already install, you may need to install the sysfsutils package.
# yum install sysfsutils
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 HBA ports in details:
Check if the host has HBA card installed and which type of card installed,
# lspci | grep -i fibre
15:00.0 Fibre Channel: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA (rev 02)
15:00.1 Fibre Channel: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA (rev 02)
physical slot, driver, module information
# lspci -v -s 15:00.0
15:00.0 Fibre Channel: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA (rev 02)
Subsystem: QLogic Corp. Device 015d
Physical Slot: 2
Flags: bus master, fast devsel, latency 0, IRQ 24
I/O ports at 2200 [size=256]
Memory at 97b00000 (64-bit, non-prefetchable) [size=16K]
Expansion ROM at 90000000 [disabled] [size=256K]
Capabilities: [44] Power Management version 3
Capabilities: [4c] Express Endpoint, MSI 00
Capabilities: [88] MSI: Enable- Count=1/32 Maskable- 64bit+
Capabilities: [98] Vital Product Data
Capabilities: [a0] MSI-X: Enable+ Count=2 Masked-
Capabilities: [100] Advanced Error Reporting
Capabilities: [138] Power Budgeting <?>
Kernel driver in use: qla2xxx
Kernel modules: qla2xxx
Here is another example Emulex Card
# lspci -v -s 10:00.0
10:00.0 Fibre Channel: Emulex Corporation Zephyr-X LightPulse Fibre Channel Host Adapter (rev 02)
Subsystem: Emulex Corporation Zephyr-X LightPulse Fibre Channel Host Adapter
Physical Slot: 2
Flags: bus master, fast devsel, latency 0, IRQ 26
Memory at c7eff000 (64-bit, non-prefetchable) [size=4K]
Memory at c7efec00 (64-bit, non-prefetchable) [size=256]
I/O ports at 6000 [size=256]
[virtual] Expansion ROM at c0000000 [disabled] [size=256K]
Capabilities: [58] Power Management version 2
Capabilities: [60] MSI: Enable+ Count=1/16 Maskable- 64bit+
Capabilities: [44] Express Endpoint, MSI 00
Capabilities: [100] Advanced Error Reporting
Capabilities: [12c] Power Budgeting <?>
Kernel driver in use: lpfc
Kernel modules: lpfc
Check if the driver/module loaded in kernel.
# lsmod | grep qla2xxx
qla2xxx 425817 288
scsi_transport_fc 55299 1 qla2xxx
To check the state of the HBA ports (online/offline) :
# systool -c fc_host -v | grep port_state
port_state = "Online"
port_state = "Online"