How to Check HBA WWN WWNN WWPN on Linux?

Updated: Jul 30

How to get HBA WWPN on Linux is a common task for a storage engineer. We need the WWPN to configure zone on the switch side.We will look at this question today.

In our SAN environment, we have two HBAs installed on the Linux system. We can get the HBA WWN/WWPN using the following way without installing any package.




How to check HBA WWNN WWPN on Linux?

$ find /sys/class/fc_host/*/ -name 'port_name' << retrieve path to wwpn entry

/sys/class/fc_host/host0/port_name
/sys/class/fc_host/host5/port_name

$ find /sys/class/fc_host/*/ -name 'node_name' << retrieve path to wwnn entry

/sys/class/fc_host/host0/node_name
/sys/class/fc_host/host5/node_name

$ grep -v "zZzZ" -H /sys/class/fc_host/host*/*_name

/sys/class/fc_host/host0/fabric_name:0x200a000decdf9601
/sys/class/fc_host/host0/node_name:0x2000001b32923dc9
/sys/class/fc_host/host0/port_name:0x2100001b32923dc9      <<WWPN
/sys/class/fc_host/host0/symbolic_name:QLE2462 FW:v8.07.00 DVR:v10.01.00.22.07.9-k
/sys/class/fc_host/host5/fabric_name:0x2014000decdf9581
/sys/class/fc_host/host5/node_name:0x2001001b32b23dc9
/sys/class/fc_host/host5/port_name:0x2101001b32b23dc9     << WWPN
/sys/class/fc_host/host5/symbolic_name:QLE2462 FW:v8.07.00 DVR:v10.01.00.22.07.9-k

$ find /sys/devices -type d -name 'host*' | egrep -v "host_busy|fc_host|scsi_host" | sort

/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/host7
/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/host7/sas_host/host7
/sys/devices/pci0000:00/0000:00:03.0/0000:03:00.0/host0
/sys/devices/pci0000:00/0000:00:03.0/0000:03:00.1/host5
/sys/devices/pci0000:00/0000:00:1a.7/usb1/1-4/1-4:1.0/host6
/sys/devices/pci0000:00/0000:00:1f.2/ata1/host1
/sys/devices/pci0000:00/0000:00:1f.2/ata2/host2
/sys/devices/pci0000:00/0000:00:1f.5/ata3/host3
/sys/devices/pci0000:00/0000:00:1f.5/ata4/host4


Related Post:

15 Linux multipath examples for Linux admin

158 views