Removing manually configured FCP LUNs and their SCSI device

6.18 LPAR mode z/VM guest

Manually remove a SCSI device if your environment is not set up to use NPIV or if you disabled automatic LUN scan.

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.

Procedure

Follow these steps to remove a manually configured FCP LUN and its SCSI device:
  • For a persistent configuration, use the chzdev command. Issue a command of this form:
    # chzdev -d zfcp-lun <device_bus_id>:<wwpn>:<fcp_lun> 
  • For the current configuration only, use the chzdev command with the -a option or sysfs.
    • To use chzdev, issue a command of this form:
      # chzdev -d -a zfcp-lun <device_bus_id>:<wwpn>:<fcp_lun> 
    • To use sysfs, follow this procedure:
      1. Optional: To manually unregister the device, write 1 to the delete attribute of the directory that represents the device in the sysfs SCSI branch. See Mapping the representations of a SCSI device in sysfs for information about how to find this directory. Issue a command of this form:
        # echo 1 > /sys/bus/scsi/devices/<device>/delete
      2. Remove the SCSI device from the target port by writing the device's LUN to the port's unit_remove attribute. Issue a command of this form:
        # echo <fcp_lun> > /sys/bus/ccw/drivers/zfcp/<device_bus_id>/<wwpn>/unit_remove
        where the variables have the same meaning as in Configuring SCSI devices. Removing a LUN with unit_remove automatically unregisters the SCSI device first.

Example

The following example removes a SCSI device with LUN 0x4010403200000000, accessed through a target port with WWPN 0x500507630300c562 and is attached through an FCP device with bus ID 0.0.3d0c. The corresponding directory in the sysfs SCSI branch is assumed to be /sys/bus/scsi/devices/0:0:1:1077035024.

  • To remove the LUN and make the configuration change persistent, use:
    # chzdev -d zfcp-lun 0.0.3d0c:0x500507630300c562:0x4010403200000000
  • For a non-persistent configuration, use the chzdev command with the -a option:
    # chzdev -d -a zfcp-lun 0.0.3d0c:0x500507630300c562:0x4010403200000000
    Alternatively, for a non-persistent configuration, you can also use sysfs:
    1. Optionally, unregister the device:
      # echo 1 > /sys/bus/scsi/devices/0:0:1:1077035024/delete
    2. Remove the device (if not done in previous step) and the LUN:
      # echo 0x4010403200000000 > /sys/bus/ccw/drivers/zfcp/0.0.3d0c/0x500507630300c562/unit_remove