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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • 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. who: command not found
  2. initctl Command Examples in Linux
  3. qm clone Command Examples in Linux
  4. How to uninstall postgresql-client-common software package in Ubuntu
  5. How to change the default location (/var/cache/yum) of yum cache
  6. Unable to set a GRUB password on a Raspberry Pi 3 system
  7. sed: command not found
  8. halt Command Examples in Linux
  9. /dev/shm permission change after node reboot
  10. “passwd: Module is unknown” – error while changing the password in CentOS/RHEL 6

You May Also Like

Primary Sidebar

Recent Posts

  • aws ec2: CLI for AWS EC2 (Command Examples)
  • aws cur – Create, query, and delete AWS usage report definitions (Command Examples)
  • aws configure – Manage configuration for the AWS CLI (Command Examples)
  • aws cognito-idp: Manage Amazon Cognito user pool and its users and groups using the CLI

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright