Linux Fiber Channel

 

Home Up

 

IBM eServer zSeries Linux Fibre Channel Adapter Device Driver Configuration for Tape Devices

Abstract

This tip gives some hints for enabling the FICON adapter in IBM eServer zSeries Linux so that it can load a tape device.

Contents

The information in this tip is taken from the IBM Redpaper Getting Started with zSeries Fibre Channel Tape Protocol, REDP0205, and the Redbook Implementing IBM LTO in Linux and Windows, SG24-6268.

The Linux Fibre Channel adapter device driver zfcp.o is available in the kernel RPM package from your Linux distributor that supports the zSeries Fibre Channel Protocol. By default, zfcp.o is not loaded into the running kernel. There are three ways that you can load zfcp.o to see the tape devices on your system:

1. Create an /etc/zfcp.conf file and make a ramdisk to statically attach tape devices into your system. This method is recommended if you have a persistent mapping in a SAN environment. Every time you reboot the system, the zfcp will be automatically loaded, and the tape devices can be seen from the system.

2. Modify the /etc/modules.conf file to add the zfcp module parameters; then run the depmod -A and modprobe zfcp commands. Please do not use this choice together with option 1, because it will cause conflicts. The zfcp map in /etc/modules.conf always takes higher priority than the map in /etc/zfcp.conf.

3. Run the modprobe zfcp command first, and then dynamically add a tape device into the system after you physically attach a Fibre Channel tape device to the switch.

1. Use the /etc/zfcp.conf file

First, you need add the device map to this file. The following is an example of zfcp.conf:

0xf1c0 0x1:0x5005076300402733 0x0:0x0000000000000000;\

0xf1c1 0x1:0x5005076300402733 0x0:0x0001000000000000

The zfcp device driver uses the map module parameter to recognize a physically

attached tape device. The map takes the following format:

map="<devno><port scsi-id>:<wwpn><unit-scsi-lun>:<fcp-lun>;

Where:

devno: The device number of the HBA (16-bit, see /proc/subchannels). It is 0xf1c0 or 0xf1c1 in the above example.

port scsi-id: Linux internal SCSI ID assigned to the Fibre Channel port of the SCSI target device (32-bit, must not be 0, must be a unique one-to-one mapping for each World Wide Port Name). It is 0x1 in the above example.

wwpn: World Wide Port Name identifying the Fibre Channel port of the SCSI target device (64-bit). It is 0x5005076300402733 in the above example.

unit scsi-lun: Linux internal SCSI Logical Unit Number (32-bit). It is 0x0 in the above example.

fcp-lun: Logical Unit Number associated with the SCSI target device (64-bit). In the above example,

0x0000000000000000 is the Logical Unit Number 0, and 0x0001000000000000 is the Logical Unit Number 1.

We recommend, for tape attachment, that each LUN be associated with a unique devno. If you use the same devno numbers for several logical units, you should ensure that each <unit-scsi-lun> is unique.

After /etc/zfcp.conf is created, run the following commands:

>mk_initrd

>zipl

Reboot the system. After it is booted up, your tape device should be shown in the /proc/scsi/scsi file.

2. Modify the /etc/modules.conf file

You can add tape device mapping to the /etc/modules.conf file if you do not want to use the /etc/zfcp.conf file. The following example demonstrates the zfcp configuration in /etc/modules.conf:

 

options zfcp map="\

0xf1c0 0x1:0x5005076300402733 0x0:0x0000000000000000;\

0xf1c1 0x1:0x5005076300402733 0x0:0x0001000000000000"

 

The map arguments are the same as the ones listed for the /etc/zfcp.conf file. After modifying /etc/modules.conf, save and close it. Then run the following commands:

 

>depmod -A

>modprobe zfcp

 

This installs the zfcp device driver and all of its prerequisite kernel modules. Now, you can check the file /proc/scsi/scsi to see if all of the attached tape devices are shown in this file. If not, then check the Fibre Channel connection, such as the fiber cables, if the devices are powered on, and so on.  Then run the following commands to install zfcp:

 

>rmmod zfcp

>modprobe zfcp

3. Dynamically attaching a tape device

If you physically attach a tape device on the switch, and zfcp is already loaded, you do not need to reboot the Linux system to add this entry in the /proc/scsi/scsi file. The zfcp device driver provides an add_map proc system entry under the directory /proc/scsi/zfcp to allow you to dynamically add the device into the system. For example, to add two LUNs from the above example into the system, you can issue the following commands:

 

>echo "0xf1c0 0x1:0x5005076300402733 0x0:0x0000000000000000;\

0xf1c1 0x1:0x5005076300402733

0x0:0x0001000000000000">/proc/scsi/zfcp/add_map

>echo "scsi add-single-device 0 0 10">/proc/scsi/scsi

>echo "scsi add-single-device 1 0 11">/proc/scsi/scsi

The “scsi add-single-device” takes four parameters, corresponding to the four parameters scsi, channel, id, and lun in the /proc/scsi/scsi file. The value of scsi is 0 for the first devno, 1 for the second devno (if it is different from the first devno), and so forth. The value of channel can start from 0 for each different SCSI value. The value of id is the one you use for <unit scsi-lun> in the above mapping. The value of lun is the LUN of the target device, for example, the last number in the above mapping.

Currently, the zfcp device driver does not support dynamically removing the attached devices. If you need to remove the tape devices from the system, do rmmod zfcp. Then, you can delete the entry in the /etc/modules.conf file and reload zfcp, or reload zfcp first and dynamically add the devices you want.

After you have done all the mapping, if you can see all of the attached tape devices in /proc/scsi/scsi, you have successfully attached those devices to your system.

 

  Home | Contact Tim | About | Links

Order a book or two today - you can download an eBook today for only $1.99!

            

Just click on a book to learn more!