How To Find WWN in Linux Check HBA Connectivity Status

Find WWN in Linux is easy using existing commands and installing few systools will help us in getting the FC HBA adapter WWN in Linux. There are several ways to find out FC HBA WWN in Linux/Unix operating systems.

How To Find WWN in Linux Check HBA Connectivity Status

We can use lspci command to find the FC HBA adapter details first. lspci is a utility for displaying information about PCI buses in the system and devices connected to them.

Method 1

# lspci |grep -i hba
0e:04.0 Fibre Channel: QLogic Corp. ISP2422-based 4Gb Fibre Channel to PCI-X HBA (rev 02)

above command will give us an whether Host Bus Adapter is installed in our Linux machine or not. If HBA is installed then we can see it’s details as shown above.

check how many hosts (Ports/Cards) are there in your Linux machine using below command

# ls /sys/class/fc_host
host3

Using below command find if FC HBA is Online or Offline Or Link Status. If link status is down also we can get WWN in Linux. Below while loop script will list all of your HBA card details.

ls /sys/class/fc_host/ | while read host ; do cat /sys/class/fc_host/$host/port_state ; done

Find all the card information using below command

ls /sys/class/fc_host/ | while read host ; do cat /sys/class/fc_host/$host/port_name ; done

Method 2 – Find WWN in Linux

Another way of finding WWN in Linux is using systool utility this is an extra package you have to install in your Linux server using below command

# yum install sysfsutils
wwn in linux

install sysfsutils

After successful installation run below command to get all the details about FC HBA

$ systool -c fc_host -v
Class = "fc_host"

Class Device = "host3"
 Class Device path = "/sys/devices/pci0000:00/0000:00:06.0/0000:0c:00.2/0000:0e:04.0/host3/fc_host/host3"
 dev_loss_tmo = "30"
 fabric_name = "0xffffffff"
 issue_lip = <store method only>
 max_npiv_vports = "127"
 node_name = "0x2101001c321fb8f6"
 npiv_vports_inuse = "0"
 port_id = "0x000000"
 port_name = "0x2101001b321fb8f6"
 port_state = "Linkdown"
 port_type = "Unknown"
 speed = "unknown"
 supported_classes = "Class 3"
 supported_speeds = "1 Gbit, 2 Gbit, 4 Gbit"
 symbolic_name = "QLA2460 FW:v7.03.00 DVR:v8.07.00.26.06.8-k"
 system_hostname = ""
 tgtid_bind_type = "wwpn (World Wide Port Name)"
 uevent =
 vport_create = <store method only>
 vport_delete = <store method only>

Device = "host3"
 Device path = "/sys/devices/pci0000:00/0000:00:06.0/0000:0c:00.2/0000:0e:04.0/host3"
 optrom_ctl = <store method only>
 reset = <store method only>
 uevent = "DEVTYPE=scsi_host"

All above details are not required for us just grep the required details using grep command

# cat /sys/class/fc_host/host3/port_state
Linkdown

# systool -c fc_host -v | grep port_name
 port_name = "0x2101001b321fb8f6"

Highlighted in orange color is the WWN of FC HBA card host3

That’s it about finding the WWN in Linux using command line utilities

Related Articles

How To Configure Linux LVM with Multipath enabled

How to install Ansible in RHEL 7

ps command in Linux

Linux Video Tutorial

Thanks for your wonderful Support and Encouragement