Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the rank-math domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/u763016847/domains/golinuxhub.com/public_html/wp-includes/functions.php on line 6114
How to check the number of HBA cards or ports are available in my Linux setup ? - GoLinuxHub

How to check the number of HBA cards or ports are available in my Linux setup ?

In my earlier article I had given a bunch of commands which can help a newbie understand dm multipath

Tutorial/Cheatsheet: Begineer's Guide to Understanding Device Mapper Multipath for Linux

Method 1

On a Linux box with Emulex NIC card you can view the available HBA cards using below command

# lspci  | grep -i fibre
04:00.2 Fibre Channel: Emulex Corporation OneConnect 10Gb FCoE Initiator (be3) (rev 01)
04:00.3 Fibre Channel: Emulex Corporation OneConnect 10Gb FCoE Initiator (be3) (rev 01)

Here as you see my node has an Emulex 554FLB NIC card with be2net driver

# ethtool -i eth0 | grep driver
driver: be2net

On a Linux machine with Qlogic card you can use below command to check the available HBA cards

# lspci  | grep -i hba
03:00.0 Fibre Channel: QLogic Corp. ISP2432-based 4Gb Fibre Channel to PCI Express HBA (rev 03)
03:00.1 Fibre Channel: QLogic Corp. ISP2432-based 4Gb Fibre Channel to PCI Express HBA (rev 03)

Here as you see my node has an Qlogic 530FLB NIC card with bnx2x driver

# ethtool -i eth0 | grep driver
driver: bnx2x

Method 2

Or you can install sysfsutils rpm to get systool which can also show you similar information

# systool -D -c fc_host
Class = "fc_host"

  Class Device = "host0"

  Class Device = "host1"

Method 3

If you do not have this tool available then you can get the list of HBA at below location

# ls -ld /sys/class/fc_host/*
lrwxrwxrwx 1 root root 0 May 22 18:29 /sys/class/fc_host/host0 -> ../../devices/pci0000:00/0000:00:02.0/0000:04:00.2/host0/fc_host/host0
lrwxrwxrwx 1 root root 0 May 22 18:29 /sys/class/fc_host/host1 -> ../../devices/pci0000:00/0000:00:02.0/0000:04:00.3/host1/fc_host/host1

Here as you see I have two HBA with the name host0 and host1

I hope the article was useful.