Manually configured FCP LUNs and their SCSI devices

6.6 LPAR mode z/VM guest

For FCP devices that do not use NPIV mode, or if automatic LUN scanning is disabled, FCP LUNs must be configured manually to obtain SCSI devices.

Before you begin

Attention: The following procedure ignores distribution specifics and might interfere with configuration tools provided by your distribution. Always use distribution-specific configuration tools if available.

See the documentation that is provided by your distributor about which tools to use for a persistent configuration in a production environment. You can always specify additional zfcp module parameters as explained in Kernel and module parameters

Procedure

If your FCP device does not use NPIV mode, or if you have disabled automatic LUN scanning, proceed as follows:

  • Use the chzdev command.
    To enable a FCP device and create a persistent configuration, issue:
    # chzdev -e zfcp-lun <device_bus_id>:<wwpn>:<fcp_lun>
    where:
    <device_bus_id>
    specifies the FCP device.
    <wwpn>
    is the WWPN of the target port.
    <fcp_lun>
    is the LUN of the SCSI device to be configured. The LUN is a 16 digit hexadecimal value padded with zeros, for example 0x4010403300000000.
    This command starts a process with multiple steps:
    1. It creates a directory in /sys/bus/ccw/drivers/zfcp/<device_bus_id>/<wwpn> with the LUN as the directory name. The directory is part of the list of all LUNs to configure. Without NPIV or with auto LUN scanning disabled, zfcp registers only FCP LUNs contained in this list with the Linux® SCSI stack in the next step.
    2. It initiates the registration of the SCSI device with the Linux SCSI stack. The FCP device must be online for this step.
    3. It waits until the Linux SCSI stack registration completes successfully or returns an error. It then returns control to the shell. A successful registration creates a sysfs entry in the SCSI branch (see Mapping the representations of a SCSI device in sysfs).
  • To enable a FCP device for the current configuration only, you can use either chzdev or sysfs:
    • To use chzdev with the -a option, issue a command of this form:
      # chzdev -e -a zfcp-lun <device_bus_id>:<wwpn>:<fcp_lun>
    • To use sysfs, configure a SCSI device for a target port and write the device's LUN to the port's unit_add attribute. Issue a command of this form:
      # echo <fcp_lun> > /sys/bus/ccw/drivers/zfcp/<device_bus_id>/<wwpn>/unit_add

Examples

For a persistent configuration, use chzdev. In this example, an FCP device with bus ID 0.0.3dc0 is enabled. The WWPN of the target port is 0x500507630300c562. A SCSI device with LUN 0x4010403300000000 is added to the port.
# chzdev -e zfcp-lun 0.0.3dc0:0x500507630300c562:0x4010403300000000
This creates a configuration that is persistent across boots.
For changes to the current configuration only, use chzdev with the -a option. In this example, the same configuration as in the previous example is made, but will not be persistent across re-boots:
# chzdev -e -a zfcp-lun 0.0.3dc0:0x500507630300c562:0x4010403300000000
For the current configuration only, you can also use sysfs. In this example, a target port with WWPN 0x500507630300c562 is attached through an FCP device with bus ID 0.0.3d0c. A SCSI device with LUN 0x4010403200000000 is already configured for the port. An additional SCSI device with LUN 0x4010403300000000 is added to the port.
# ls /sys/bus/ccw/drivers/zfcp/0.0.3d0c/0x500507630300c562/0x*
0x4010403200000000
# echo 0x4010403300000000 > /sys/bus/ccw/drivers/zfcp/0.0.3d0c/0x500507630300c562/unit_add
# ls /sys/bus/ccw/drivers/zfcp/0.0.3d0c/0x500507630300c562/0x*
0x4010403200000000
0x4010403300000000

What to do next

To check whether a SCSI device is registered for the configured LUN, check for a directory with the name of the LUN in /sys/bus/scsi/devices. If there is no SCSI device for this LUN, the LUN is not valid in the storage system, or the FCP device is offline in Linux.

To see which LUNs are currently configured for the port, list the contents of /sys/bus/ccw/drivers/zfcp/<device_bus_id>/<wwpn>.