≡ Menu

HBA WWN: How to Find Qlogic or Emulex HBA Card WWN Address on Linux

Question: How do I lookup the wwn address of my HBA card installed on the Linux system. I need this information to create zoning on my fiber channel switch.

Answer: Use one of the following methods to view the HBA WWN address on Linux.

Method 1: /sys/class/scsi_host/host{n}/device/fc_host:host{n}/port_name File

On Redhat 5 and above (including OEL and CentOS), the /sys/class/scsi_host/host{n}/device/fc_host:host{n}/port_name file contains the HBA WWN information as shown below. Please substitude n with either 0, 1, or 2 according to your system.

For example:

$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.3 (Tikanga)


$ cat /sys/class/scsi_host/host1/device/fc_host:host1/port_name
0x2100001c111111c1

Method 2: /proc/scsi/{adapter-type}/{n} File

On Redhat 4 and below (including OEL and CentOS), the /proc/scsi/{adapter-type}/{n} file contains the HBA WWN information as shown below.

{adapter-type} can be either qlaxxxx for QLogic adapters (or) lpfc for Emulex adapters.
Please substitude n with either 0, 1, or 2 according to your system.

The example belows shows the WWN number of the qlogic 2300 adapter on RedHat 3.

$ cat /etc/redhat-release
Enterprise Linux Enterprise Linux AS release 3 (Update 9)

$ cat /proc/scsi/qla2300/1
QLogic PCI to Fibre Channel Host Adapter for QLA2460:
        Firmware version:  4.00.23, Driver version 7.07.05
Entry address = f888d060

Request Queue = 0x37280000, Response Queue = 0x37270000
Request Queue count= 512, Response Queue count= 512
Total number of active commands = 2
Total number of interrupts = -1635473967
Total number of active IP commands = 0
Total number of IOCBs (used/max) = (0/0)
Total number of queued commands = 2
    Device queue depth = 0x20
Number of free request entries = 454
Number of mailbox timeouts = 0
Number of ISP aborts = 0
Number of loop resyncs = 0
Number of retries for empty slots = 0
Number of reqs in pending_q= 0, retry_q= 0, done_q= 0, scsi_retry_q= 0
Host adapter:loop state= , flags= 0x70013
Dpc flags = 0x0
MBX flags = 0x0
SRB Free Count = 4094
Link down Timeout = 045
Port down retry = 045
Login retry count = 045
Commands retried with dropped frame(s) = 0
Configured data rate: 4 Gb/sec


SCSI Device Information:
scsi-qla0-adapter-node=2000002c222c2cc2;
scsi-qla0-adapter-port=2100002c222c2cc2;
scsi-qla0-target-0=5006016022c22c2c;
scsi-qla0-target-1=5006016822c22c2c;

SCSI LUN Information:
(Id:Lun)  * - indicates lun is not registered with the OS.
( 0: 0): Total reqs -877237672, Pending reqs 0, flags 0x0, 0:0:81,
( 0: 1): Total reqs 1074740881, Pending reqs 2, flags 0x0, 0:0:81,
( 0: 2): Total reqs 439861869, Pending reqs 0, flags 0x0, 0:0:81,
( 0: 3): Total reqs 417766757, Pending reqs 0, flags 0x0, 0:0:81,
( 1: 0): Total reqs 1174574, Pending reqs 0, flags 0x0, 0:0:82,
( 1: 1): Total reqs 1906876572, Pending reqs 0, flags 0x0, 0:0:82,
( 1: 2): Total reqs 1175529, Pending reqs 0, flags 0x0, 0:0:82,
( 1: 3): Total reqs 1173331, Pending reqs 0, flags 0x0, 0:0:82,
Add your comment

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

Comments on this entry are closed.

  • Anonymous August 20, 2010, 8:24 pm

    Personally, I use systool.

    The following will give you the verbose output so you can see which HBA is which.
    systool -c fc_host -v

  • jms667 February 22, 2011, 4:24 am

    Hi,
    On a RH 5.x box, command “cat /sys/class/fc_host/hostn/port_name” works better.
    Regards,
    jms

  • mattrob September 16, 2011, 1:36 pm

    thank you for this post. I helped greatly.

  • Anonymous September 28, 2011, 1:03 am

    Personally for me, cat /proc/scsi/lpfc/2 worked. and I have a Emulex HBA.

  • Sassan September 25, 2012, 6:42 pm

    thank you for the post. it helped me. The second method has scsi heading but FC. You need to issue
    cat /sys/class/fc_host/hostN/device/fc_host:hostN/*
    this will give you all the FC HBA information.

  • Uriel Punk January 29, 2013, 10:09 am

    rpm -q –whatprovides /usr/bin/systool sysfsutils-1.2.0-1

    systool -av -c fc_host |grep -i port_name|awk ‘{print $NF}’|awk -F’x’ ‘{print $2}’|sed ‘s/\”//g’|while read a; do echo $a|sed ‘s/../&:/g’;done;

  • Liivo L. February 28, 2014, 6:16 am

    cat /sys/class/scsi_host/host*/device/fc_host/host*/node_name

  • kumar September 9, 2015, 4:45 pm

    How can we confirm the HBA’s Emulex or Qlogic on linux host ?