Red Hat Training

A Red Hat training course is available for Red Hat Linux

19.2. Adding FCP-attached Logical Units (LUNs)

The following is an example of how to add an FCP LUN.

Note

If running under z/VM, make sure the FCP adapter is attached to the z/VM guest virtual machine. For multipathing in production environments there would be at least two FCP devices on two different physical adapters (CHPIDs). For example:
CP ATTACH FC00 TO *
CP ATTACH FCD0 TO *

19.2.1. Dynamically Activating an FCP LUN

Follow these steps to activate a LUN:
  1. Use the cio_ignore utility to remove the FCP adapter from the list of ignored devices and make it visible to Linux:
    # cio_ignore -r device_number
    Replace device_number with the device number of the FCP adapter. For example:
  2. To bring the FCP adapter device online, use the following command:
    # chccwdev -e fc00
  3. Verify that the required WWPN was found by the automatic port scanning of the zfcp device driver:
    # ls -l /sys/bus/ccw/drivers/zfcp/0.0.fc00/
    drwxr-xr-x.  3 root root    0 Apr 28 18:19 0x500507630040710b
    drwxr-xr-x.  3 root root    0 Apr 28 18:19 0x50050763050b073d
    drwxr-xr-x.  3 root root    0 Apr 28 18:19 0x500507630e060521
    drwxr-xr-x.  3 root root    0 Apr 28 18:19 0x500507630e860521
    -r--r--r--.  1 root root 4096 Apr 28 18:17 availability
    -r--r--r--.  1 root root 4096 Apr 28 18:19 card_version
    -rw-r--r--.  1 root root 4096 Apr 28 18:17 cmb_enable
    -r--r--r--.  1 root root 4096 Apr 28 18:17 cutype
    -r--r--r--.  1 root root 4096 Apr 28 18:17 devtype
    lrwxrwxrwx.  1 root root    0 Apr 28 18:17 driver ->  ../../../../bus/ccw/drivers/zfcp
    -rw-r--r--.  1 root root 4096 Apr 28 18:17 failed
    -r--r--r--.  1 root root 4096 Apr 28 18:19 hardware_version
    drwxr-xr-x. 35 root root    0 Apr 28 18:17 host0
    -r--r--r--.  1 root root 4096 Apr 28 18:17 in_recovery
    -r--r--r--.  1 root root 4096 Apr 28 18:19 lic_version
    -r--r--r--.  1 root root 4096 Apr 28 18:17 modalias
    -rw-r--r--.  1 root root 4096 Apr 28 18:17 online
    -r--r--r--.  1 root root 4096 Apr 28 18:19 peer_d_id
    -r--r--r--.  1 root root 4096 Apr 28 18:19 peer_wwnn
    -r--r--r--.  1 root root 4096 Apr 28 18:19 peer_wwpn
    --w-------.  1 root root 4096 Apr 28 18:19 port_remove
    --w-------.  1 root root 4096 Apr 28 18:19 port_rescan
    drwxr-xr-x.  2 root root    0 Apr 28 18:19 power
    -r--r--r--.  1 root root 4096 Apr 28 18:19 status
    lrwxrwxrwx.  1 root root    0 Apr 28 18:17 subsystem ->  ../../../../bus/ccw
    -rw-r--r--.  1 root root 4096 Apr 28 18:17 uevent
  4. Activate the FCP LUN by adding it to the port (WWPN) through which you would like to access the LUN:
    # echo 0x4020400100000000 > /sys/bus/ccw/drivers/zfcp/0.0.fc00/0x50050763050b073d/unit_add
  5. Find out the assigned SCSI device name:
    # lszfcp -DV
    /sys/devices/css0/0.0.0015/0.0.fc00/0x50050763050b073d/0x4020400100000000
    /sys/bus/ccw/drivers/zfcp/0.0.fc00/host0/rport-0:0-21/target0:0:21/0:0:21:1089355792

19.2.2. Persistently activating FCP LUNs

The above instructions described how to activate FCP LUNs dynamically in a running system. However, such changes are not persistent and do not survive a reboot. How you make the changes to the FCP configuration persistent in your Linux system depends on whether the FCP LUNs belong to the root file system. Those required for the root file system need to be activated very early during the boot process by the initramfs to be able to mount the root file system. The cio_ignore commands are handled transparently for persistent device configurations and you do not need to free devices from the ignore list manually.

19.2.2.1. FCP LUNs That Are Part of the Root File System

The only file you have to modify for adding FCP LUNs that are part of the root file system is /etc/zipl.conf followed by a run of the zipl boot loader tool. There is no more need to recreate the initramfs.
Red Hat Enterprise Linux provides a parameter to activate FCP LUNs early in the boot process: rd.zfcp=. The value is a comma-separated list containing the device bus ID, the WWPN as 16 digit hexadecimal number prefixed with 0x, and the FCP LUN prefixed with 0x and padded with zeroes to the right to have 16 hexadecimal digits.
The following example zipl.conf is for a system that uses physical volumes on partitions of two FCP LUNs for an LVM volume group vg_devel1 that contains a logical volume lv_root for the root file system. For simplicity, the example shows a configuration without multipathing.
[defaultboot]
default=linux
target=/boot/

[linux]
image=/boot/vmlinuz-2.6.32-19.el7.s390x
ramdisk=/boot/initramfs-2.6.32-19.el7.s390x.img
parameters="root=/dev/mapper/vg_devel1-lv_root
rd.zfcp=0.0.fc00,0x5105074308c212e9,0x401040a000000000
rd.zfcp=0.0.fc00,0x5105074308c212e9,0x401040a100000000
rd_LVM_LV=vg_devel1/lv_root rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8
SYSFONT=latarcyrheb-sun16 KEYTABLE=us cio_ignore=all,!condev"
To add another physical volume on a partition of a third FCP LUN with device bus ID 0.0.fc00, WWPN 0x5105074308c212e9 and FCP LUN 0x401040a300000000, add rd.zfcp=0.0.fc00,0x5105074308c212e9,0x401040a300000000 to the parameters line of your boot kernel in zipl.conf. For example:
[defaultboot]
default=linux
target=/boot/

[linux]
image=/boot/vmlinuz-2.6.32-19.el7.s390x
ramdisk=/boot/initramfs-2.6.32-19.el7.s390x.img
parameters="root=/dev/mapper/vg_devel1-lv_root
rd.zfcp=0.0.fc00,0x5105074308c212e9,0x401040a000000000
rd.zfcp=0.0.fc00,0x5105074308c212e9,0x401040a100000000
rd.zfcp=0.0.fc00,0x5105074308c212e9,0x401040a300000000
rd_LVM_LV=vg_devel1/lv_root rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8
SYSFONT=latarcyrheb-sun16 KEYTABLE=us cio_ignore=all,!condev"

Warning

Make sure the length of the kernel command line in /etc/zipl.conf does not exceed 896 bytes. Otherwise, the boot loader cannot be saved, and the installation fails.
Run zipl to apply the changes of /etc/zipl.conf for the next IPL:
# zipl -V
Using config file '/etc/zipl.conf'
Target device information
Device..........................: 08:00
Partition.......................: 08:01
Device name.....................: sda
Device driver name..............: sd
Type............................: disk partition
Disk layout.....................: SCSI disk layout
Geometry - start................: 2048
File system block size..........: 4096
Physical block size.............: 512
Device size in physical blocks..: 10074112
Building bootmap in '/boot/'
Building menu 'rh-automatic-menu'
Adding #1: IPL section 'linux' (default)
kernel image......: /boot/vmlinuz-2.6.32-19.el7.s390x
kernel parmline...: 'root=/dev/mapper/vg_devel1-lv_root rd.zfcp=0.0.fc00,0x5105074308c212e9,0x401040a000000000 rd.zfcp=0.0.fc00,0x5105074308c212e9,0x401040a100000000 rd.zfcp=0.0.fc00,0x5105074308c212e9,0x401040a300000000 rd_LVM_LV=vg_devel1/lv_root rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us cio_ignore=all,!condev'
initial ramdisk...: /boot/initramfs-2.6.32-19.el7.s390x.img
component address:
kernel image....: 0x00010000-0x007a21ff
parmline........: 0x00001000-0x000011ff
initial ramdisk.: 0x02000000-0x028f63ff
internal loader.: 0x0000a000-0x0000a3ff
Preparing boot device: sda.
Detected SCSI PCBIOS disk layout.
Writing SCSI master boot record.
Syncing disks...
Done.

19.2.2.2. FCP LUNs That Are Not Part of the Root File System

FCP LUNs that are not part of the root file system, such as data disks, are persistently configured in the file /etc/zfcp.conf. It contains one FCP LUN per line. Each line contains the device bus ID of the FCP adapter, the WWPN as 16 digit hexadecimal number prefixed with 0x, and the FCP LUN prefixed with 0x and padded with zeroes to the right to have 16 hexadecimal digits, separated by a space or tab. Entries in /etc/zfcp.conf are activated and configured by udev when an FCP adapter is added to the system. At boot time, all FCP adapters visible to the system are added and trigger udev.
Example content of /etc/zfcp.conf:
0.0.fc00 0x5105074308c212e9 0x401040a000000000
0.0.fc00 0x5105074308c212e9 0x401040a100000000
0.0.fc00 0x5105074308c212e9 0x401040a300000000
0.0.fcd0 0x5105074308c2aee9 0x401040a000000000
0.0.fcd0 0x5105074308c2aee9 0x401040a100000000
0.0.fcd0 0x5105074308c2aee9 0x401040a300000000
Modifications of /etc/zfcp.conf only become effective after a reboot of the system or after the dynamic addition of a new FCP channel by changing the system's I/O configuration (for example, a channel is attached under z/VM). Alternatively, you can trigger the activation of a new entry in /etc/zfcp.conf for an FCP adapter which was previously not active, by executing the following commands:
  1. Use the cio_ignore utility to remove the FCP adapter from the list of ignored devices and make it visible to Linux:
    # cio_ignore -r device_number
    Replace device_number with the device number of the FCP adapter. For example:
    # cio_ignore -r fcfc
  2. To trigger the uevent that activates the change, issue:
    # echo add > /sys/bus/ccw/devices/device-bus-ID/uevent
    For example:
    # echo add > /sys/bus/ccw/devices/0.0.fcfc/uevent