Discover LUNs in the Fibre Channel storage area network (SAN)

Red Hat Enterprise Linux 8.6 LPAR mode z/VM guest

Discovering LUNs only makes sense for NPIV-enabled FCP devices without zfcp automatic LUN scan.

zfcp automatic LUN scan is available as of kernel version 2.6.37, if not disabled with zfcp.allow_lun_scan=0.
Note: Discovering LUNs causes extra SAN traffic for each target port WWPN.
Temporary LUN Attachment
If not attached already, lsluns temporarily attaches LUN 0 (or if this fails, the WLUN 0xc101000000000000) during runtime. Do not terminate lsluns with a signal. Signals interfere with the removal of temporarily attached LUNs.
Storage Products
Some storage products return a peripheral device type of 31==0x1f with peripheral qualifier 0 in a SCSI standard INQUIRY command for an unmapped FCP LUN 0. Examples are: IBM Storwize products, including IBM V7000, IBM V840, IBM V9000, and IBM SAN Volume Controller. For lsluns to work with such storage products, you must have a host mapping on the storage side, which maps some volume to exported FCP LUN 0x0000000000000000 (Storwize host map property "SCSI ID" 0) for each used FCP-device initiator WWPN. The volume can be a minimum-sized thin-provisioned shared stand-in volume.

lsluns syntax

Filter the listing by specifying one or more FCP device bus-IDs, target port WWPNs, or both.

Read syntax diagramSkip visual syntax diagramlsluns-c <device_bus_id>-p <wwpn>
Where:
-c <device_bus_id> or --ccw <device_bus_id>
filters LUNs by one or more adapters with the specified FCP device-bus IDs. When used in conjunction with −p, only those LUNs are listed that also satisfy at least one of the −p constraints.
-p <wwpn> or --port <wwpn>
filters LUNs by one or more target ports with the specified WWPNs. When used in conjunction with −c, only those LUNs are listed that also satisfy at least one of the −c constraints.
-v or --version
displays version information and exits.
-h or --help
displays an overview of the syntax. To view the man page, enter man lsluns.

Examples

  • This example lists all LUNs discovered in the FC SAN on adapter 0.0.3922:
    # lsluns -c 0.0.3922
  • This example shows all LUNs discovered in the FC SAN on target port 0x500507630300c562:
    # lsluns -p 0x500507630300c562
    Scanning for LUNs on adapter 0.0.5922
            at port 0x500507630300c562:
                    0x4010400000000000
                    0x4010400100000000
                    0x4010400200000000
                    0x4010400300000000
                    0x4010400400000000
                    0x4010400500000000
  • This example shows all LUNs discovered in the FC SAN on:
    • Adapter 0.0.3922 and port 0x5005123456789000
    • Adapter 0.0.3922 and port 0x5005abcdefabc000
    • Adapter 0.0.fc00 and port 0x5005123456789000
    • Adapter 0.0.fc00 and port 0x5005abcdefabc000
    # lsluns -c 0.0.3922 −c 0.0.fc00 −p 0x5005123456789000 −p 0x5005abcdefabc000