identify hba wwn and state
If you don’t have systool
from the sysfsutils
package in your environment, you can use the following to find the WWNs and states of all HBA ports on your host:
for host in $(find /sys/class/fc_host/ -type l); do if [[ $(< "${host}/port_state") == "Online" ]]; then echo $(basename "$host") && cat "${host}/port_"{state,name}; fi done
host0
Online
0x4c957a1ee90e713b
host2
Online
0xf4e6905b36393d76
WWNs are 8 bytes and will match: 0\[xX]([0-9a-fA-F]){16}
.
The above WWNs were randomly generated:
openssl rand -hex 8