Triggering a LUN scan for NPIV FCP devices using sysfs

For FCP setups using NPIV, the zfcp device driver automatically scans for and attaches available SCSI devices, that is, LUNs with valid host connections for the WWPN of the NPIV FCP device.

About this task

You can optionally trigger a scan for LUNs using sysfs, for example, if you have accidentally deleted a port. To trigger the scan for all available remote ports issue, for example:
# echo ’- - -’ >\
/sys/bus/ccw/drivers/zfcp/0.0.1901/host0/scsi_host/host0/scan
where the three dashes (- - -) are SCSI channel ID, SCSI target ID, and LUN (in the Linux packed LUN format, that is, the last part in the ID 0:0:5:1079066641). The minus-sign (-) is the wildcard character. The SCSI channel ID is always 0, so writing 0 is equivalent to using the wildcard for the SCSI channel ID.
To trigger the scan for a specific port, first look up the target ID of the remote port to scan. The SCSI target ID is the last part of the remote port ID:
# lszfcp -P -p 0x5005076303100104 -b 0.0.1901
0.0.1901/0x5005076303100104 rport-0:0-9
Then issue the scan for the single SCSI target ID:
# echo ’0 9 -’ >\
/sys/bus/ccw/drivers/zfcp/0.0.1901/host0/scsi_host/host0/scan