Persistent naming support
/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.
An example is provided on udev for implementing a persistent name. The example must be customized to fit a user’s needs and environment.
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
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.
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.
- 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"
- Stop the lin_taped daemon.
lin_taped stop
- 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
- 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
- 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. - Check that the devices are all correctly listed with the following
command.
ls -l /dev/lin_tape/by-id/
- Restart the lin_taped daemon.
lin_taped start