Persistent naming support

Lin_tape Persistent Naming is implemented through the Linux® udev utility. Udev is a service that monitors changes in system hardware configuration and completes actions that are based on what devices are attached to the Linux system. It can be configured to create symbolic links (persistent names) to a device based on attributes that a driver exports for that device. The persistent name can then be used as the device name to open and complete IO to a tape drive or medium changer. This action makes it possible to reference a static name, such as
/dev/lin_tape/by-id/lin_tape4801101
This name is always associated with the same physical device, rather than being required to reference the device name /dev/IBMtape0, which can change names and become /dev/IBMtape1 after the driver is reinstalled.

Lin_tape exports several attributes that can be used as the basis to create persistent names. These attributes can be reported to the user through udevadm info on recent Linux kernels, or udevinfo on older Linux kernels. The udevinfo and udevadm are udev management tools. These tools can query the udev database for device information and properties that are stored in the udev base for help creating udev rules.

Note: Udev, udevinfo, and udevadm are not implemented or maintained by the lin_tape driver. Refer to the man pages for udevadm or udevinfo for details on usage. These man pages are system specific and supersede all information in this document. For questions on these utilities, you must contact your Linux support representative.

An example is provided on udev for implementing a persistent name. The example must be customized to fit a user’s needs and environment.

Note: Variations exist between kernels.
If a tape device is attached to the Linux system with worldwide port name 0x123456789ABCDEF0 with a current device name of /dev/IBMtape0, a user can run udevadm information to obtain information on exported attributes for this device. This procedure can be done as follows,
>udevadm info --attribute-walk --name /dev/IBMtape0
The output of this command includes something similar to
    ATTRS{serial_num}=="123456789"
    ATTRS{ww_node_name}=="0x123456789ABCDEF1"
    ATTRS{ww_port_name}=="0x123456789ABCDEF0"

If you are using udevinfo, enter the previous command as

>udevinfo -a -p `udevinfo -q path -n /dev/IBMtape0`
or
>udevinfo -a -p /sys/class/lin_tape/IBMtape0
(Both commands return the same information).

Also, on some kernels an attribute ATTRS{xxx} is replaced by SYSFS{xxx}. Furthermore, some kernels use a '=' (single equal sign) to indicate an attribute match and also an assignment. Whereas, other kernels use a '==' (double equal sign) for a match and '=' for assignment. Place the attribute from the attribute list into your rules file exactly as it appears in the attribute list, as described here.

The ww_port_name is in a rules file that assigns a symbolic link to a device that has the listed worldwide port name. The file typically is placed in /etc/udev/rules.d, but this location might be changed by the udev_rules directive in the /etc/udev/rules.conf file. In this example, a file is created that is called /etc/udev/rules.d/98-lin_tape.rules and write a single line to the file.
KERNEL=="IBMtape*", ATTRS{ww_port_name}=="0x123456789ABCDEF0", 
SYMLINK="lin_tape/by-id/lin_tape4801101"

Assuming that the udev service is running and configured correctly, the user can install or reinstall lin_tape with modprobe, and the symbolic link is created in the /dev/lin_tape/by-id folder. One line must be added to the 98-lin_tape.rules file for each wanted symbolic link.

With lin_tape version 2.2.0, a parameter, persistent_n_device, is added to support persistent naming of no rewind devices. The default value is 0 (off). To enable this support, complete the following steps.
  1. Modify the 98-lin_tape.rules file to differentiate standard devices and no rewind devices. For example,
    KERNEL=="IBMtape*[0-9]", ATTR{serial_num}=="1013000306", SYMLINK="lin_tape/by-id/IBMtape0"
    KERNEL=="IBMtape*n", ATTR{serial_num}=="1013000306", SYMLINK="lin_tape/by-id/IBMtape0n"
  2. Stop the lin_taped daemon.
    lin_taped stop
  3. Unload the lin_tape driver from the memory.
    modprobe -r lin_tape
    
    Only if sfmp was enabled unload stmp/sgmp:
    modprobe -r stmp
    modprobe -r sgmp
    
    modprobe -r pfo
  4. Add the following line in your /etc/modprobe.conf or /etc/modprobe.conf.local file (or, if you are running RHEL 6 or higher, in your /etc/modprobe.d/lin_tape.conf file).
    options lin_tape  persistent_n_device=1
  5. Reload the lin_tape driver into memory.
    modprobe pfo
    modprobe lin_tape
    
    Only if sfmp was enabled load stmp/sgmp:
    modprobe stmp
    modprobe sgmp
    Note: Wait at least 10 seconds between step 3 (modprobe -r lin_tape) and step 5 (modprobe lin_tape) in order for udev to correctly configure the devices.
  6. Check that the devices are all correctly listed with the following command.
    ls -l /dev/lin_tape/by-id/
  7. Restart the lin_taped daemon.
    lin_taped start