how to identify hba cards ports and wwn in linux

Published by RSY Digital World on

How to identify hba cards ports and wwn in RHEL 7

Too often system administrators requires to collect details about host bus adapters in linux. In this article we are going to discuss about 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 redhat 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 validate sysfsutils/systool presence
We can validate presence of sysutils in your server using 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

# 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

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

# 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 above you can find whatever information is needed about HBA. Hope this will help you about how to identify hba cards ports and wwn in linux.

That,s it about how to identify hba cards ports and wwn in linux .

Please join our Facebook group to see more. 

||| Cheers |||

Related Posts