How to Find WWN Number Information in Linux

How-to-find-WWN-in-Linux

How to Find WWN Number Information 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 find wwn number information 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.

Let us check few related things before directly going for how to find WWN number information in linux. Let us first check if HBA is installed or not in your linux server.

How to Check Which HBA Card is Installed in Linux

There are multiple options for how you can check which HBA card is installed in linux. Let`s go through some of them.

# 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 Check sysfsutils/systool is installed or not in Linux

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

Method 1: Use the which command

# which systool          
/usr/bin/systool
//This is showing path for systool it means sysutils package is
already installed.//

Method 2: Use the 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 in Linux

If it is not installed as mentioned above you can refer to how to install sysfsutils in linux below.

# 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

So now we have systool in action. Let us see how we can use systool to get all related information related to HBA.

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.

How to get HBA Port Status in Linux

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

How to Get HBA Port Speed in Linux

# cat /sys/class/fc_host/host*/speed
4 Gbit
4 Gbit

How to Get HBA Supported Speed in Linux

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

Getting Other HBA Details in Linux 

# 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

We have seen how we can get various details about HBA and about WWN in linux. So let us come to our main topic about how to Find WWN Number Information in Linux.

First, we will see how systool can help and then proceed with the alternate procedure on how to find WWN number information in linux.

How to Find WWN in Linux

There are various methods that are helpful to find WWN lumber in Linux. As mentioned we will start with the systool.  

First Method

How to find WWN Number Information in Linux using systool

systool utility comes with linux distros. If it is not available it can be installed on servers where HBA is already installed which will be really helpful in how to find WWN number information in linux.

 # systool -c fc_host -v
(output truncated for clarity)
Class Device path = "/sys/class/fc_host/host8"
port_name= "10:00:00:00:c9:b0:51:32"
node_name= "20:00:00:00:c9:b0:51:32"

Second Method

How to find WWN Number Information in Linux using the system-level command

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

Third Method

How to find WWN Number Information in Linux using syminq command

If EMC Storage is being used so there is a chance you must have SYMCLI software installed. syminq comes with SYSCLI.syminq is also helpful in getting WWN in an easy way.

[root@server]# syminq hba
Host Name           : server
HBA Type            : FibreChannel
HBA Name            : Emulex-LPe11000-E-2
Vendor              : Emulex Corporation
Model               : LPe11000-E
Serial Number       : BT01473025
Firmware Version    : 2.72A2 (Z3D2.72A2), sli-3
Driver Version      : 8.2.0.63.3p; HBAAPI(I) v2.1.g, 12-07-07
Node WWN            : 20000000c9b0513a
Number of Ports     : 1
Port WWN            : 10000000c9b0513a
Port name           : /sys/class/scsi_host/host3
Port type           : NPort
Port FCID           : 2764032
Port speed          : 4gbit
Supported speed     : 4gbit
Port state          : Online
Supported COS       : 00000008
Supported FC4 types : 00000100000000010000000
Active FC4 types    : 00000100000000010000000
Max frame size      : 2048

Fourth Method

How to find WWN Number Information in Linux using hbacmd command

hbacmd command can be used to find WWN in linux. It will work if hbanyware package is installed on the server.

# /usr/sbin/hbanyware/hbacmd listHBAs
Manageable HBA List
Port WWN   : 10:00:00:00:c9:b0:55:2e
Node WWN   : 20:00:00:00:c9:b0:55:2e
Fabric Name: 10:00:50:eb:1a:5f:c7:0c
Flags      : 8000fe00
Host Name  : server
Mfg        : Emulex Corporation
Serial No. : BT01474056
Port Number: n/a
Mode       : Initiator
Port WWN   : 10:00:00:00:c9:b0:51:32
Node WWN   : 20:00:00:00:c9:b0:51:32
Fabric Name: 10:00:50:eb:1a:5f:bd:0c
Flags      : 8000fe00
Host Name  : server
Mfg        : Emulex Corporation
Serial No. : BT01472998
Port Number: n/a
Mode       : Initiator
#

 

Conclusion

That`s it about how to find WWN Number information in linux. Using all the above methods you can find wwn number information in linux and all other HBA and WWN related information in linux. Hope this will help you with your query about how to find WWN Number information in linux.