Setting an FCP device online or offline

7.1 LPAR mode z/VM guest

In traditional LPAR mode FCP devices are offline by default. Set an FCP device online before you perform any other tasks.

As of z14 and IBM LinuxONE II in DPM mode:

For Linux® in a DPM partition, FCP devices are set online automatically, see Device configuration for machines running in PR/SM mode.

DPM device auto-configuration with zfcp automatic LUN scan manages the zfcp configuration, including FCP devices, remote ports, and LUNs. This automation has the following requirements:
  • The SAN switches must use single-initiator zoning.
  • LUN masking (host mapping) must be in place on the storage systems.
  • Both the SAN switches and the LUN masking must use host NPIV WWPNs for access control.

Before you begin

This procedure is intended for experimental environments only and might interfere with distribution-specific tools.

See the documentation that is provided by your distributor about which tools to use for a persistent configuration in a production environment.

About this task

See Working with newly available devices to avoid errors when you work with devices that have become available to a running Linux® instance.

Important: Configuration changes can directly or indirectly affect information that is required to mount the root file system. Such changes require an update of the initramfs, followed by a re-write of the boot record.

Setting an FCP device online registers it with the Linux SCSI stack and updates the symbolic port name for the device on the FC name server. For FCP setups that use NPIV mode, the device bus-ID and the host name of the Linux instance are added to the symbolic port name.

Setting an FCP device online also automatically runs the scan for ports in the SAN and waits for this port scan to complete.

To check if setting the FCP device online was successful, you can use a script that first sets the FCP device online and after this operation completes checks if the WWPN of a target port has appeared in sysfs.

When you set an FCP device offline, the port and LUN subdirectories are preserved. Setting an FCP device offline in sysfs interrupts the communication between Linux and the FCP channel. After a timeout has expired, the port and LUN attributes indicate that the ports and LUNs are no longer accessible. The transition of the FCP device to the offline state is synchronous, unless the device is disconnected.

For disconnected devices, writing 0 to the online sysfs attribute triggers an asynchronous deregistration process. When this process is completed, the device with its ports and LUNs is no longer represented in sysfs.

When the FCP device is set back online, the SCSI device names and minor numbers are freshly assigned. The mapping of devices to names and numbers might be different from what they were before the FCP device was set offline.

Procedure

For a persistent configuration, use the chzdev command.

For a non-persistent configuration, you can use:

  • The chzdev command with the -a option.
  • The chccwdev command.
  • The sysfs attribute online. Write 1 to an FCP device's online attribute to set it online, or 0 to set it offline.

Examples

  • For a persistent configuration, to set an FCP device with bus ID 0.0.3d0c online, issue:
    # chzdev -e zfcp-host 0.0.3d0c
    This setting persists across re-boots. For more details, see Device configuration with chzdev and lszdev. To apply this setting to the running system only, use the chzdev command with the -a option:
    # chzdev -e -a zfcp-host 0.0.3d0c
    Alternatively, for the current configuration only, you can use one of the following commands:
    # chccwdev -e 0.0.3d0c
    or
    # echo 1 > /sys/bus/ccw/drivers/zfcp/0.0.3d0c/online
  • To set an FCP device with bus ID 0.0.3d0c offline, issue:
    # chzdev -d zfcp-host 0.0.3d0c
    This setting persists across re-boots. To apply this setting to the running system only, use the chzdev command with the -a option:
    # chzdev -d -a zfcp-host 0.0.3d0c
    Alternatively, for the current configuration only, you can use one of the following commands:
    # chccwdev -d 0.0.3d0c
    or
    # echo 0 > /sys/bus/ccw/drivers/zfcp/0.0.3d0c/online