Setting a DASD online or offline

Use the chccwdev command or the online sysfs attribute of the device to set DASDs online or offline.

About this task

When Linux boots, it senses your DASD. Depending on your specification for the "dasd=" parameter, it automatically sets devices online.

Procedure

Use the chccwdev command to set a DASD online or offline.

Alternatively, you can write 1 to the device's online attribute to set it online or 0 to set it offline. In contrast to the sysfs attribute, the chccwdev command triggers a cio_settle for you and waits for the cio_settle to complete.

Outstanding I/O requests are canceled when you set a device offline. To wait indefinitely for outstanding I/O requests to complete before setting the device offline, use the chccwdev option --safeoffline or the sysfs attribute safe_offline.

When you set a DASD offline, the deregistration process is synchronous, unless the device is disconnected. For disconnected devices, the deregistration process is asynchronous.

Examples

  • To set a DASD with device bus-ID 0.0.b100 online, issue:
    # chccwdev -e 0.0.b100
    or
    # echo 1 > /sys/bus/ccw/devices/0.0.b100/online
  • To set a DASD with device bus-ID 0.0.b100 offline, issue:
    # chccwdev -d 0.0.b100
    or
    # echo 0 > /sys/bus/ccw/devices/0.0.b100/online
  • To complete outstanding I/O requests and then set a DASD with device bus-ID 0.0.4711 offline, issue:
    # chccwdev -s 0.0.4711
    or
    # echo 1 > /sys/bus/ccw/devices/0.0.4711/safe_offline
    If an outstanding I/O request is blocked, the command might wait forever. Reasons for blocked I/O requests include reserved devices that can be released or disconnected devices that can be reconnected.
    1. Try to resolve the problem that blocks the I/O request and wait for the command to complete.
    2. If you cannot resolve the problem, issue chccwdev -d to cancel the outstanding I/O requests. The data is lost.

Dynamic attach and detach

You can dynamically attach devices to a running Red Hat Enterprise Linux 7.5 for z Systems instance, for example, from z/VM®.

When a DASD is attached, Linux attempts to initialize it according to the DASD device driver configuration. You can then set the device online. You can automate setting dynamically attached devices online by using CCW hotplug events.

Attention: Do not detach a device that is still being used by Linux. Detaching devices might cause the system to hang or crash. Ensure that you unmount a device and set it offline before you detach it.

Be careful to avoid errors when working with devices that have become available to a running Linux instance.