UNIX & LINUX‎ > ‎

How change device name with UDEV

How change device name and see it in /dev/mapper

For instance we have new raw device /dev/sdd

fdisk -l /dev/sdd


Create the partition:

fdisk /dev/sdd

-> n -> p -> 1 -> enter -> enter -> enter -> w

The partition /dev/sdd1 was created.

Create a new udev rule for identification of new device:

vi /etc/udev/rules.d/30-test-rule.rules

KERNEL=="sd?", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/scsi_id --whitelisted --device=/dev/%k"
KERNEL=="sd?1", ENV{ID_SERIAL}=="", IMPORT{parent}=="ID_*"
KERNEL=="sd?1", ENV{ID_SERIAL}=="57442D5743414E4B38343139353830", NAME+="mapper/test_disk_name", OWNER:="oracle", GROUP:="dba", MODE:="0660"


* how get the new device's serial id 
/lib/udev/scsi_id --whitelisted --device=/dev/sdd
output: 57442D5743414E4B38343139353830

After create/update the udev rule, please run command:
start_udev

Now, if you run ls -l /dev/mapper, you get in output:

brw-rw----.    1    oracle    dba    5,    123    Mar    23    15:15    test_disk_name