If any Linux server or system is connected to one or more SAN switches through Fibre Channel (FC) HBA cards then it is very important for the storage team that they assign the storage to the correct server via WWN numbers of FC HBA cards. There are many methods and commands through which you can determine the WWN number of a Fibre Channel (FC) HBA and their status online/offline.
WWN: World Wide Name
Find Fibre HBA WWN Details in Linux
Method 1
Run the below command to see the list of all hosts
[root@dbappweb ~]# ls /sys/class/scsi_host
host0 host1 host10 host11 host12 host2 host3 host4 host5 host6 host7 host8 host9
Run the below command for each host to see the WWN number of the HBA
[root@dbappweb ~]# cat /sys/class/scsi_host/host0/device/fc_host/host0/port_name cat: /sys/class/scsi_host/host0/device/fc_host/host0/port_name: No such file or directory [root@dbappweb ~]# cat /sys/class/scsi_host/host1/device/fc_host/host1/port_name 0x21000024ff12331c
Go to /sys/class/scsi_host directory and run the below command to see the WWN number of all the HBA cards connected to the server.
[root@dbappweb ~]# cd /sys/class/scsi_host [root@dbappweb scsi_host]# for i in 0 1 2 3 4 5 6 7 8 9 10 11 12; do cat host$i/device/fc_host/host$i/port_name; done cat: host0/device/fc_host/host0/port_name: No such file or directory 0x21000024ff12331c 0x21000024ff123304 cat: host3/device/fc_host/host3/port_name: No such file or directory cat: host4/device/fc_host/host4/port_name: No such file or directory cat: host5/device/fc_host/host5/port_name: No such file or directory cat: host6/device/fc_host/host6/port_name: No such file or directory cat: host7/device/fc_host/host7/port_name: No such file or directory cat: host8/device/fc_host/host8/port_name: No such file or directory cat: host9/device/fc_host/host9/port_name: No such file or directory cat: host10/device/fc_host/host10/port_name: No such file or directory cat: host11/device/fc_host/host11/port_name: No such file or directory cat: host12/device/fc_host/host12/port_name: No such file or directory [root@dbappweb scsi_host]#
Method 2
Run the below command to find all HBA cards installed on the server
[root@dbappweb ~]# lspci -nn |grep -i hba
03:00.0 Fibre Channel [0c04]: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA [1077:2532] (rev 02)
04:00.0 Fibre Channel [0c04]: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA [1077:2532] (rev 02)
Run the below command to find the available HBA ports
[root@dbappweb ~]# ls -l /sys/class/fc_host
total 0
lrwxrwxrwx 1 root root 0 Oct 26 17:10 host1 -> ../../devices/pci0000:00/0000:00:02.0/0000:03:00.0/host1/fc_host/host1
lrwxrwxrwx 1 root root 0 Oct 26 17:10 host2 -> ../../devices/pci0000:00/0000:00:02.2/0000:04:00.0/host2/fc_host/host2
Run the below command to check the status of the HBA ports whether they are online or offline
[root@dbappweb ~]# more /sys/class/fc_host/host?/port_state
::::::::::::::
/sys/class/fc_host/host1/port_state
::::::::::::::
Online
::::::::::::::
/sys/class/fc_host/host2/port_state
::::::::::::::
Online
Run the below command to find the WWN number of the HBA
[root@dbappweb ~]# more /sys/class/fc_host/host?/port_name
::::::::::::::
/sys/class/fc_host/host1/port_name
::::::::::::::
0x21000024ff12331c
::::::::::::::
/sys/class/fc_host/host2/port_name
::::::::::::::
0x21000024ff123304
No Responses