How To Find WWN, WWNN and WWPN Number Of HBA Card In Linux

There are several ways/commands to determine the WWN of a Fibre Channel (FC) HBA and their details in Linux/Unix operating systems.

What is SAN? Most of the IT industries are using SAN (Storage Area Network) for high performance, and fast I/O.

SAN is a high speed network that makes connections between storage devices and servers which give better performance. It’s connected through Fibre Channel (FC) HBA.

SCSI (Small Computer System Interface) is a protocol which used to communicate between servers and storage devices.

Why we need to check this? If any Linux server or system is connected to one or more SAN switches through Fibre Channel (FC) HBA cards then storage team have to create a zoning on fiber channel switch to assign and unassign storage to a concern Linux host.

Navigate to the following URLs if you are looking for hardware related Linux commands.

Suggested Read : Hardware Related Linux Commands

If we need any additional storage for Linux host then we need to provide the WWN number to storage team and they can assign a new LUN based on the WWN number.

To discover the new LUNs which was assigned by storage team, we need to scan the SCSI host.

The famous FC Host Bus Adapters are QLogic, Emulex, Brocade, Cisco, etc.

Some of the important key notes about this.

  • WWN – World Wide Name
  • WWNN – World Wide Node Name
  • WWPN – World Wide Port Name
  • OUI – Organizationally Unique Identifier

How To Find The List of HBA Cards Installed On Your System

First identify how many HBA cards are installed on your system by running lspci command.

# lspci -nn | grep -i hba
07:00.0 Fibre Channel [0c04]: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA [1077:2532] (rev 02)
07:00.1 Fibre Channel [0c04]: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA [1077:2532] (rev 02)
08:00.0 Fibre Channel [0c04]: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA [1077:2532] (rev 02)
08:00.0 Fibre Channel [0c04]: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA [1077:2532] (rev 02)

Navigate to the following URL to know more about lspci command.

Suggested Read : How To Use lspci, lsscsi, lsusb, And lsblk To Get Linux System Devices Information

Method-1: Manual Way to Identify HBA Cards information

This can be done using two methods, here i’m going to show you how to check this using manual method.

To check the available HBA ports, just navigate to the below path and check.

# ls -l /sys/class/fc_host
total 0
lrwxrwxrwx 1 root root 0 Oct 26 17:10 host1 -> ../../devices/pci0000:00/0000:00:02.0/0000:03:00.0/host1/fc_host/host1
lrwxrwxrwx 1 root root 0 Oct 26 17:10 host2 -> ../../devices/pci0000:00/0000:00:02.2/0000:04:00.0/host2/fc_host/host2
lrwxrwxrwx 1 root root 0 Oct 26 17:10 host3 -> ../../devices/pci0000:00/0000:00:02.2/0000:04:00.0/host2/fc_host/host3
lrwxrwxrwx 1 root root 0 Oct 26 17:10 host4 -> ../../devices/pci0000:00/0000:00:02.2/0000:04:00.0/host2/fc_host/host4

To View used HBA ports on server

#ls -lrt /sys/class/fc_transport/

drwxr-xr-x  2 root root 0 May 27 09:40 target7:0:2
drwxr-xr-x  2 root root 0 May 27 09:40 target7:0:1
drwxr-xr-x  2 root root 0 May 27 09:40 target7:0:0
drwxr-xr-x  2 root root 0 May 27 09:40 target5:0:2
drwxr-xr-x  2 root root 0 May 27 09:40 target5:0:1
drwxr-xr-x  2 root root 0 May 27 09:40 target5:0:0

To find the WWN numbers for your fc host, just run the below command to list it.

# cat /sys/class/fc_host/host?/port_name

0x500143802426baf2

0x500143802426baf3

0x500143802426baf4

0x500143802426baf5

If you would like to check the particular fc host wwn number, use the following format.

# cat /sys/class/fc_host/host1/node_name

0x500143802426baf2

Run the below command to check the state of HBA ports.

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

::::::::::::::

/sys/class/fc_host/host1/port_state

::::::::::::::

Online

::::::::::::::

/sys/class/fc_host/host2/port_state

::::::::::::::

Online

::::::::::::::

/sys/class/fc_host/host3/port_state

::::::::::::::

Online

::::::::::::::

/sys/class/fc_host/host4/port_state

::::::::::::::

Online

Method-2: How to Identify HBA Cards Information Using systool

Systool is a tool that uses APIs provided by libsysfs to gather information, view system device information by bus, class, and topology. It runs only on linux systems running kernels 2.5 or later, with the sysfs filesystem mounted.

It won’t install by default since isn’t a core tool, just run the below command to install sysfsutils package.

# yum install sysfsutils

Once the sysfsutils package get installed on your system, to find the WWN numbers for your fc host, just run the below command to list it.

# systool -c fc_host -v | grep port_name

    port_name           = "0x500143802426baf2"

    port_name           = "0x500143802426baf3"

    port_name           = "0x500143802426baf4"

    port_name           = "0x500143802426baf5"

Run the below command to check the state of HBA ports.

# systool -c fc_host -v | grep port_state

    port_state          = "Online"

    port_state          = "Online"

    port_state          = "Online"

    port_state          = "Online"

To view details about transporting HBA card

#systool -c fc_transport -v

If you would like to check the particular fc host wwn number, use the following format.

# systool -c fc_host -v -d host2 | grep port_name

Prakash Subramanian

Prakash Subramanian is a Linux lover and has 3.5+ years of experience in linux server administration with major Linux distribution such as (RHEL, CentOS, Ubuntu). He is currently working as a Senior L2 Linux Server administrator.

You may also like...

Shares
Close
Please support the site
By clicking any of these buttons you help our site to get better