wwn of a linux hba

By thomas, 21 July, 2010
My problem is that I wanted to filter access on a raid array instead of doing it on the switch. I could login to the switch and figure out the linux hba's wwn (world-wide-name), but I thought there must be a way to get it from the linux machine directly.

Here's the steps

  1. determine the hba's scsi bus number, set VENDOR to the vendor of your fibre channel array
    [root@host ~] grep -B1 "Vendor: $VENDOR" /proc/scsi/scsi |grep Host |head Host: scsi3 Channel: 00 Id: 00 Lun: 00 Host: scsi3 Channel: 00 Id: 00 Lun: 01 Host: scsi3 Channel: 00 Id: 00 Lun: 02 Host: scsi3 Channel: 00 Id: 00 Lun: 03
    In this case, my magical number is 3.
  2. find the fc_host directory for the hba
    RHEL5
    [root@host ~] cd /sys/class/scsi_host/host3/device/fc_host:host3
    RHEL6
    [root@host ~] cd /sys/class/scsi_host/host3/device/fc_host/host3/
  3. look in port_name
    [root@host host3]# cat port_name 0x2001002219....4f
Hope that helps...