• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Configure Persistent Names for Tape Devices in CentOS/RHEL

by admin

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.

Note: The following procedure does not require a reboot.

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

Filed Under: CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. Sample /etc/services file in Linux
  2. Beginners Guide to Managing Package Module Streams in CentOS/RHEL 8
  3. Connection using SSH to a Host Not in DNS/hosts Stalls for Some Time at Connection Initiation
  4. sa Command Examples in Linux
  5. How to generate PGP keys using GPG on Linux
  6. How To Change Pacemaker Cluster Heartbeat Timeout In CentOS/RHEL 7
  7. fossil: Distributed version control system
  8. CentOS / RHEL 6 : How to password protect grub (Password-Protected Booting)
  9. auditd Command Examples in Linux
  10. How to monitor /etc/shadow and /etc/passwd file for changes with Auditd?

You May Also Like

Primary Sidebar

Recent Posts

  • gml2gv Command Examples
  • glow Command Examples
  • glib-compile-resources Command Examples
  • glances Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright