November 18

Linux: HBA port information

Verify the status of a server's HBA ports:
grep -v "zZzZ" -H /sys/class/fc_host/host*/port_state
systool -c fc_host -v - This requires the package, sysfsutils to be installed.

modinfo qla2xxx | grep version
srcversion:     67989F13670BACC60C8CA47
vermagic:       4.1.12-124.17.1.el6uek.x86_64 SMP mod_unload modversions 


more /sys/class/fc_host/host?/port_name

Get the hardware information for the HBA to determine if the HBA runs fine, including the PCI registers mapping,  capabilities description, and the driver in use:

$ lspci -vv | grep "Fibre Channel"

Get the HBA WWPN:
$ cat /sys/class/fc_host/host*/port_name

Get the HBA WWNN:
$ cat /sys/class/fc_host/host*/node_name

Get the HBA Speed: 
$ cat /sys/class/fc_host/host*/speed

Get the HBA port state:
$ cat /sys/class/fc_host/host*/port_state

Get the HBA port TYPE:
$ cat /sys/class/fc_host/host*/port_type

Get the HBA statistics:
$ cat /sys/class/fc_host/host*/statistics 

Successful Commands with Oracle Linux after new luns are mapped to the server from the SAN:

See the device mapping:
dmsetup info -c -o name,blkdevname,devnos_used,blkdevs_used,UUID

Rescan for devices - there should not be much IO going on when doing the following command
 echo "1" > /sys/class/fc_host/host1/issue_lip 

Verify the status of the rescan:
cat /var/log/messages

See the device mapping after rescan:
dmsetup info -c -o name,blkdevname,devnos_used,blkdevs_used,UUID


Use these commands carefully as I/O needs to be stopped to keep from running into issues.
The following commands can be used to scan storage interconnects:

echo "1" > /sys/class/fc_host/host/issue_lip

    This operation performs a Loop Initialization Protocol (LIP), scans the interconnect, and causes the SCSI layer to be updated to reflect the devices currently on the bus. Essentially, an LIP is a bus reset, and causes device addition and removal. This procedure is necessary to configure a new SCSI target on a Fibre Channel interconnect.
    Note that issue_lip is an asynchronous operation. The command can complete before the entire scan has completed. You must monitor /var/log/messages to determine when issue_lip finishes.
    The lpfc, qla2xxx, and bnx2fc drivers support issue_lip. For more information about the API capabilities supported by each driver in Red Hat Enterprise Linux, see Table 26.1, “Fibre-Channel API Capabilities”. 


    The /usr/bin/ script was introduced in Red Hat Enterprise Linux 5.4. By default, this script scans all the SCSI buses on the system, and updates the SCSI layer to reflect new devices on the bus. The script provides additional options to allow device removal, and the issuing of LIPs. For more information about this script, including known issues, see Chapter 38, Adding/Removing a Logical Unit Through 

echo "- - -" > /sys/class/scsi_host/hosth/scan

    This is the same command as described in Chapter 31, Adding a Storage Device or Path to add a storage device or path. In this case, however, the channel number, SCSI target ID, and LUN values are replaced by wildcards. Any combination of identifiers and wildcards is allowed, so you can make the command as specific or broad as needed. This procedure adds LUNs, but does not remove them. 
modprobe --remove driver-name, modprobe driver-name
    Running the modprobe --remove driver-name command followed by the modprobe driver-name command completely re-initializes the state of all interconnects controlled by the driver. Despite being rather extreme, using the described commands can be appropriate in certain situations. The commands can be used, for example, to restart the driver with a different module parameter value. 

Copyright 2021. All rights reserved.

Posted November 18, 2021 by Timothy Conrad in category "Linux

About the Author

If I were to describe myself with one word it would be, creative. I am interested in almost everything which keeps me rather busy. Here you will find some of my technical musings. Securely email me using - PGP: 4CB8 91EB 0C0A A530 3BE9 6D76 B076 96F1 6135 0A1B