How to Identify HBA Cards Ports and WWN in Linux

How to Identify HBA Cards Ports and WWN in Linux

RSY Digital World Logo

How to Identify HBA Cards Ports and WWN in Linux

Too often system administrators require to collect details about host bus adapters in Linux. In this article, we are going to discuss how to identify hba card ports and wwn in linux.

There are many other way and utility which is helpful in getting details but sysfsutils is the package delivered via Red Hat repository which is very helpful while dealing with any kind of HBA details and it usage systool command or script to fetch the required details.

How to Check sysfsutils/systool presence

We can validate the presence of sysutils in your server using the below method.

Method 1 : Use which command

# which systool         

/usr/bin/systool

//This is showing path for systool it means sysutils package is already installed.//

Method 2: Use rpm command

# rpm -qa |grep sysfsutils

sysfsutils-2.1.0-16.el7.x86_64

//This is showing package as it is already installed on my server.If it is not it will not display any result.//

How to Install sysfsutils

# yum --enablerepo=* install sysfsutils
============================================================================
Package                Arch         Version           Repository  Size
============================================================================
Installing:sysfsutils  x86_64       2.1.0-16.el7      distro      41 k
Transaction Summary
============================================================================
Install  1 Package
Total size: 41 k
Installed size: 123 k
Is this ok [y/d/N]: y
Warning: RPMDB altered outside of yum.
Installed:
  sysfsutils.x86_64 0:2.1.0-16.el7

How to Check Which HBA Card is Installed

# dmesg |grep -i fibre

[    1.640026] Emulex LightPulse Fibre Channel SCSI driver 12.0.0.5 [    1.641479] scsi host1: Emulex LPe12000 PCIe Fibre Channel Adapter on PCI bus 07 device 00 irq 53

[    4.083706] scsi host4: Emulex LPe12000 PCIe Fibre Channel Adapter on PCI bus 24 device 00 irq 56

# lspci |grep -i emulex

07:00.0 Fibre Channel: Emulex Corporation Saturn-X: LightPulse Fibre Channel Host Adapter (rev 03)

24:00.0 Fibre Channel: Emulex Corporation Saturn-X: LightPulse Fibre Channel Host Adapter (rev 03)

# dmesg |grep -i emulex

[    1.640026] Emulex LightPulse Fibre Channel SCSI driver 12.0.0.5 
[    1.641479] scsi host1: Emulex LPe12000 PCIe Fibre Channel Adapter on PCI 
bus 07 device 00 irq 53
[    4.083706] scsi host4: Emulex LPe12000 PCIe Fibre Channel Adapter on PCI
bus 24 device 00 irq 56

How to get HBA Name in Linux

# systool -a -v -c scsi_host | egrep "info|modelname"
bg_info = "BlockGuard Disabled"
info = "EMC LPe12000-E 8Gb PCIe Fibre Channel Adapter on PCI bus 07 device 00 irq 53 
Logical Link Speed: 8000 Mbps"
modelname = "LPe12000-E"
npiv_info = "NPIV Physical"
nvme_info = "NVME Disabled"
bg_info = "BlockGuard Disabled"
info = "EMC LPe12000-E 8Gb PCIe Fibre Channel Adapter on PCI bus 24 device 00 irq 56 
Logical Link Speed: 8000 Mbps"
modelname = "LPe12000-E"
npiv_info = "NPIV Physical"
nvme_info = "NVME Disabled"
# cat /sys/class/fc_host/host*/symbolic_name
Emulex LPe12000-E FV1.00A12 DV12.0.0.5. HN:server231. OS:Linux
Emulex LPe12000-E FV1.00A12 DV12.0.0.5. HN:server231. OS:Linux

How to get HBA Port Status

# cat /sys/class/fc_host/host*/port_state
Online
Online

How to Get HBA Port Speed & Supported Speed

# cat /sys/class/fc_host/host*/speed
4 Gbit
4 Gbit
# cat /sys/class/fc_host/host*/supported_speeds
2 Gbit, 4 Gbit, 8 Gbit
2 Gbit, 4 Gbit, 8 Gbit

How to get Port WWN in Linux

# cat /sys/class/fc_host/host*/port_name
0x10000090fa2537d6
0x10000090fa253a29

Getting Other HBA Details

# cat /sys/class/fc_host/host*/node_name
0x20000090fa2537d6
0x20000090fa253a29
# cat /sys/class/fc_host/host*/port_type
NPort (fabric via point-to-point)
NPort (fabric via point-to-point)
# cat /sys/class/fc_host/host*/port_id
0x0a1600
0x0a2600
# cat /sys/class/fc_host/host*/fabric_name
0x100050eb1a5e9300
0x100050eb1a5e9300

Using all the above you can find whatever information is needed about HBA. Hope this will help you with how to identify HBA cards ports and WWN in Linux.

That,s it about How to Identify HBA Cards Ports and WWN in Linux .

||| Cheers |||

 

Raj Rai

Raj Rai is an experienced IT Infrastructure Professional with more than 15 years of experience in IT Infrastructure Management. Raj Raj have keen interest in sharing his real world experience in his spare time as his social responsibility for IT infrastructure field. This is his contribution for IT infrastructure management sector for either newbie or even experienced professionals in unix linux cloud network and storage administration field.

Leave a Reply