• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar

The Geek Diary

HowTos | Basics | Concepts

  • Solaris
    • Solaris 11
    • SVM
    • ZFS
    • Zones
    • LDOMs
    • Hardware
  • Linux
    • CentOS/RHEL 7
    • RHCSA notes
    • SuSE Linux Enterprise
    • Linux Services
  • VCS
    • VxVM
  • Interview Questions
  • oracle
    • ASM
    • mysql
    • RAC
    • oracle 12c
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Hadoop
    • Hortonworks HDP
      • HDPCA
    • Cloudera
      • CCA 131

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. Understanding Fencing in a Red Hat High Availability Cluster
  2. How to move spfile from ASM to filesystem
  3. CentOS / RHEL : How to remove used Physical Volume(PV) from Volume Group (VG) in LVM
  4. How To Get (and modify) limits For a Running Process in Linux
  5. CentOS / RHEL 5 : How to disable device mapper multipath (dm-multipath)
  6. How to Recreate a VDO (Virtual Data Optimizer) index
  7. RHEL 7 – RHCSA Notes : Create hard and soft links.
  8. How to automate sftp file transfers using expect utility
  9. fdisk: Unable to write /dev/sdg: Bad file descriptor – error while formatting USB disk
  10. How to extract RPM package without installing it

You May Also Like

Primary Sidebar

Recent Posts

  • How to disable firewalld and nftables and use iptables instead in CentOS/RHEL 8
  • How to add an Ethernet connection using nmcli in CentOS/RHEL 7
  • How to set the order to load certain modules in CentOS/RHEL 7 and 8
  • How to configure initrd / initramfs to including kernel modules in CentOS/RHEL
  • How to configure systemd.path to trigger an event when any changes made to a directory
  • Archives
  • Contact Us
  • Copyright

© 2019 · The Geek Diary