• 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 set custom device names using udev in CentOS/RHEL 7

by admin

There could be a requirement from client to have custom device names such as /dev/asmdisk01 for an actual device with name /dev/sdb. Follow the steps outlined in this post to set custom device names using udev.

In order to create customer name (/dev/asmdisk01p1) for /dev/sdb set udev rules as below:

1. Find UUID of device

First, find the the UUID of the device with the scsi_id command as shown below.

# /usr/lib/udev/scsi_id -g -u /dev/sdb

1IET_00020002

Save this UUID, as this ID will be used later.

2. Create new udev rule

Create new udev rule file in appropriate location as below:

# vi /etc/udev/rules.d/99-my-asmdevices.rules

Add below content in 99-mydevices.rules file:

KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="1IET_00020002", RUN+="/bin/sh -c 'mknod /dev/asmdisk01p1 b $major $minor; chown grid:dba /dev/asmdisk01p1; chmod 0660 /dev/asmdisk01p1'"

Save the rule file.

3. Test new udev rule

Run below command or reboot to verify new udev rule
1. Check for new device name:

# udevadm trigger --type=devices --action=change
# /bin/ls /dev/asmdisk01p1

2. To reload udev rule execute below command:

# udevadm control --reload

3. For Troubleshooting udev rule execute below command:

# udevadm test /sys/block/sdb

Removing Device File

Remember to manually remove the device file if you no longer need it. Simply use rm to delete the device file as shown below.

# rm /dev/asmdisk01p1

Filed Under: ASM, CentOS/RHEL 7, Linux, oracle

Some more articles you might also be interested in …

  1. Oracle SQL Script: To Obtain Session Information
  2. How to install git on ubuntu 16.04
  3. Tutorial on Linux Clustering (High Availability)
  4. How to Install NTP Service and Client in CentOS/RHEL 8
  5. CentOS / RHEL 6 : How to password-protect single user mode
  6. “-bash: firewall: command not found” – How to resolve in CentOS/RHEL 7
  7. cryptcat: command not found
  8. nano: command not found
  9. How to Setup a sudo Switch to Another User That Has no Password or ssh Key Set in Linux
  10. CentOS / RHEL : How to delete a volume group in LVM

You May Also Like

Primary Sidebar

Recent Posts

  • fprintd-delete Command Examples in Linux
  • fprintd-delete: command not found
  • foreman: command not found
  • foreman Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright