On Linux, the device name may get change after reboot. This post illustrates how to configure persistent name binding for the tape device. There are 2 types of tape devices on Linux i.e. /dev/st* and /dev/nst*
/dev/stX and /dev/nstX are pointed to a same tape device, the difference is that /dev/stX is a rewinding device while /dev/nstX is non-rewinding device. When you perform operations to rewinding devices, /dev/stX will rewind to beginning of tape, and /dev/nstX would not.
Tape Device Persistent Naming Configuration
Assume that /dev/nst0 is the device need persistent naming.
1. Get the ID_SERIAL from the tape device:
# udevadm test /class/scsi_tape/nst0 ... udevadm_test: ID_SERIAL=3500104f000c8bfa2 udevadm_test: ID_SERIAL_SHORT=500104f000c8bfa2 udevadm_test: ID_WWN=0x500104f000c8bfa2 udevadm_test: ID_WWN_WITH_EXTENSION=0x500104f000c8bfa2 udevadm_test: ID_SCSI_SERIAL=HU1143K8BF udevadm_test: ID_BUS=scsi udevadm_test: ID_PATH=pci-0000:06:00.0-fc-0x500104f000c8bfa3-lun-0 udevadm_test: run: 'socket:@/org/freedesktop/hal/udev_event'
You may also try the below command which will report a same ID_SERIAL:
# udevadm test /class/scsi_tape/st0
2. Create a new udev rule file /etc/udev/rules.d/70-persistent-tape.rules. The udev load rules by the the numeric order in filename, start sequence ID 70 was chosen here, because it is greater than 60 of the default storage rule /lib/udev/rules.d/60-persistent-storage-tape.rules, hence this customized udev rule runs afterwards. Add the following lines to the file:
# vi /etc/udev/rules.d/70-persistent-tape.rules KERNEL=="st*", ENV{ID_SERIAL}=="3500104f000c8bfa2",SYMLINK+="st/tape0" KERNEL=="nst*", ENV{ID_SERIAL}=="3500104f000c8bfa2", SYMLINK+="nst/tape0"
Where,
3500104f000c8bfa2 is taken from step 1, the ID_SERIAL field.
3. Test the configuration.
# udevadm test /class/scsi_tape/nst0
If everything is fine, you should be able to see /dev/tape/tape0, and use it as a reference to the tape device.
4. Execute the following commands & apply the changes without rebooting the server:
# udevadm control –reload-rules # udevadm trigger