Friday, June 5, 2015

Locating WWPNs on Linux servers

Locating WWPNs on Linux servers

I do a lot of storage-related work, and often times need to grab WWPNs to zone hosts and to mask storage. To gather the WWPNs I would often times use the following script on my RHEL and CentOS servers:

for fc_adapter in `ls ${FC_PATH}`
    echo "${FC_PATH}/${fc_adapter}:"
    NAME=$(awk '{print $1}' ${FC_PATH}/${fc_adapter}/symbolic_name )
    echo "  $NAME `cat ${FC_PATH}/${fc_adapter}/port_name`"
This produced consolidated output similar to:
  QLE2562 0x21000024ff45afc2
  QLE2562 0x21000024ff45afc3
While doing some research I came across sysfsutils, which contains the incredibly useful systool utility. This nifty little tool allows you to query sysfs values, and can be used to display all of the sysfs attributes for your FC adapters:
systool -c fc_host -v
This output is extremely useful for storage administrators, and provides everything you need in a nice consolidated form. +1 for systool!

No comments:

Post a Comment