How to find HBA cards/ports and WWN in Linux Redhat/Centos

0
5246

Maybe you are new in a professional environment where you have to become familiar with new  terms like HBA cards and storage via Fiber or others

A host bus adapter (HBA) is a circuit board and/or integrated circuit adapter that provides input/output (I/O) processing and physical connectivity between a host system, or server, and a storage and/or network device

How to find HBA cards/ports and WWN in Linux Redhat/Centos ?

Method 1

To find the HBA cards installed on your system use :

[root@su444p043 ~]# lspci -nn | grep -i qlog
08:00.0 Fibre Channel [0c04]: QLogic Corp. ISP8324-based 16Gb Fibre Channel to PCI Express Adapter [1077:2031] (rev 02)
08:00.1 Fibre Channel [0c04]: QLogic Corp. ISP8324-based 16Gb Fibre Channel to PCI Express Adapter [1077:2031] (rev 02)
[root@su444p043 ~]#

 

To check the available HBA ports :

# ls -l   /sys/class/fc_host/
total 0
lrwxrwxrwx 1 root root 0 Apr 20 11:21 host7 -> ../../devices/pci0000:00/0000:00:03.0/0000:08:00.0/host7/fc_host/host7
lrwxrwxrwx 1 root root 0 Apr 20 11:21 host8 -> ../../devices/pci0000:00/0000:00:03.0/0000:08:00.1/host8/fc_host/host8

To find the state of HBA ports (online/offline) :

]# more /sys/class/fc_host/host?/port_state
::::::::::::::
/sys/class/fc_host/host7/port_state
::::::::::::::
Online
::::::::::::::
/sys/class/fc_host/host8/port_state
::::::::::::::
Online

 

To find the WWN numbers of the above ports :

# more /sys/class/fc_host/host?/port_state

::::::::::::::
/sys/class/fc_host/host7/port_name
::::::::::::::
0x51402ec000f497a0
::::::::::::::
/sys/class/fc_host/host8/port_name
::::::::::::::
0x51402ec000f497a2

 

Method 2 : Using systool

Another useful command to find the information about HBAs is systool. If not already installed please do it  with the following command.

# yum install sysfsutils  -y

To check the available HBA ports :

[root@------ ~]# systool -c fc_host
Class = "fc_host"

Class Device = "host7"
 Device = "host7"

Class Device = "host8"
 Device = "host8"

 

To find the WWNs for the HBA ports :

# systool -c fc_host -v | grep port_name
 port_name = "0x51402ec000f497a0"
 port_name = "0x51402ec000f497a2"

To check the state of the HBA ports (online/offline) :

# # systool -c fc_host -v | grep port_state
 port_state = "Online"
 port_state = "Online"

Please Enjoy and share !!

LEAVE A REPLY

Please enter your comment!
Please enter your name here