Tuesday 2 April 2013

How to Find HBA Card WWPN Address on Linux

We need “WWPN address” information of HBA card to create zoning on fiber channel switch to assign and unassign storage to a Linux host. There are two differnet methods to find “WWPN Address” on Linux depending upon RHEL Linux versions :

1. On Redhat Linux 5 and above . 
2. On Redhat 4 and below.

Now let’s see the two different methods to find “WWPN Address” on Linux depending upon RHEL Linux version

Method 1: 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 WWPN information.

Where n refers the number of HBA card available on the system . Please substitude n with either 0, 1, or 2 according to your system.

For example:
So from below output we can conclude there are two HBA Card on the system.
$ cd /sys/class/scsi_host/
$ ls
host0 host1
RHEL version is 5.3 as below output
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.3 (Tikanga)

From below output  we got  the WWPN address of HBA host0
$ cat /sys/class/scsi_host/host1/device/fc_host:host0/port_name
0x10000000c9f2da9c
From below output  we got  the WWPN address of HBA host1
$ cat /sys/class/scsi_host/host1/device/fc_host:host1/port_name
0x10000000c9f2da9d
So we have got two “WWPN address” as for the system as below
0x10000000c9f2da9c
0x10000000c9f2da9d
Method 2: On Redhat 4 and below (including OEL and CentOS) , the /proc/scsi/[adapter-type]/[n] file contains the HBA WWPN information.

Where

adapter-type :It can be either qlaxxxx for QLogic adapters (or) lpfc for Emulex adapters.
n refers the number of HBA card available on the system . Please substitude n with either 0, 1, or 2 according to your system.

1 comment:

  1. Hi;
    Your "WWPN address of HBA host0" and "WWPN address of HBA host1" examples are using same first host{n} which is "host1". How did you determined this?

    cat /sys/class/scsi_host/"host1"/device/fc_host:host0/port_name
    cat /sys/class/scsi_host/"host1"/device/fc_host:host1/port_name

    Sincerely,

    ReplyDelete