search
top

Retrieving EMC and Qlogic Fiber WWN on RHEL

Introduction

So you need to add storage to a RHEL (RedHat Enterprise Linux) server and the storage guy has asked you for the WWN.  The question next is how do I get the WWN off my server? So how do we get QLogic and EMC WWN’s on RHEL. It is a lot easier than one might think. Let’s move forward and get the WWN information we need!

Qlogic

First identify your installed or recognized, this is accomplished using the lspci command and grepping for fibre.

$ sudo lspci | grep -i fibre
21:00.0 Fibre Channel: QLogic Corp. ISP2432-based 4Gb Fibre Channel to PCI Express HBA (rev 02)
23:00.0 Fibre Channel: QLogic Corp. ISP2432-based 4Gb Fibre Channel to PCI Express HBA (rev 02)

Qlogic Cards are identified as FC Hosts so their information is kept in /sys/class/fc_host/hostX directory where X is a number for each host the OS sees, example: host0, host1, etc…

Now that we know we have an Qlogic card we know that /sys/class/fc_host/ is the location of our fibre card information. there are a few ways we can get the data. We can look at the contents of the /sys/class/fc_host/ directory and go into each sub-directory and get the data.

$ sudo cat /sys/class/fc_host/host1/port_name
0x2100001b32051cf9

$ sudo cat /sys/class/fc_host/host2/port_name
0x2100001b3205a7f8

Another way is to grep all of them at once by using regular expressions. and using [1-2] in the place where X goes. If you have multiple cards change the range of the numbers in [].

$ sudo cat /sys/class/fc_host/host[1-2]/port_name
0x2100001b32051cf9
0x2100001b3205a7f8

Emulex

First identify your installed or recognized, this is accomplished using the lspci command and grepping for fibre.

$ sudo lspci | grep -i fibre
21:00.0 Fibre Channel: Emulex Corporation Zephyr-X LightPulse Fibre Channel Host Adapter (rev 02)
23:00.0 Fibre Channel: Emulex Corporation Zephyr-X LightPulse Fibre Channel Host Adapter (rev 02)

EMC Cards are identified as SCSI Hosts so their information is kept in /sys/class/scsi_host/hostX directory where X is a number for each host the OS sees, example: host0, host1, etc… Buried in a few sub-directories there is a file called port_name and that is where the WWN’s reside.

Now that we know we have an Emulex (EMC) card we know that /sys/class/scsi_host/ is the location of our fibre card information. there are a few ways we can get the data. We can look at the contents of the /sys/class/scsi_host/ directory and go into each sub-directory and get the data.

$ sudo cat /sys/class/scsi_host/host1/device/fc_host\:host1/port_name
0x10000000c97df226

$ sudo cat /sys/class/scsi_host/host2/device/fc_host\:host2/port_name
0x10000000c97df05f

Another way is to grep all of them at once by using regular expressions. and using [1-2] in the place where X goes. If you have multiple cards change the range of the numbers in [].

$ sudo cat /sys/class/scsi_host/host[1-2]/device/fc_host\:host[1-2]/port_name
0x10000000c97df226
0x10000000c97df05f

Conclusion

Now that wasn’t so bad, was it? So with a few simple commands we have retrieved the WWN information from or RHEL server. You can use this process on RHEL 5, 6 & 7 releases as well as any derivatives including CentOS, Scientific Linux, etc…).

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

top