Configure udev rules for ASM devices

 

Tested Environment

  • OEL 6.4 with RAC 11.2.0.4

Key Facts

  • Don’t use /dev/sdX or /dev/dm-XX as device name as this device names can change after a reboot
  • Use the WWID for identifying devices
  • The World Wide Identifier (WWID) can be used to reliably identifying disk devices.
  • WWID is a persistent, system-independent ID that the SCSI Standard requires from all SCSI devices.

Display all available WWID on your system

Shell script to display WWID on your system
#!/bin/bash
#
#Usage:  As root user run : ./check_wwid.sh 
#
for FILE in `find /dev -name "sd*" | sort`
   do
     WWID=`scsi_id --whitelisted --replace-whitespace --device=$FILE `
     echo $FILE " WWID:  "  $WWID
   done

$ sudo ./check_wwid.sh
..
/dev/sdb   WWID:   1ATA_VBOX_HARDDISK_VB81c4f844-94203a15
/dev/sdb1  WWID:   1ATA_VBOX_HARDDISK_VB81c4f844-94203a15
/dev/sdc   WWID:   1ATA_VBOX_HARDDISK_VB2ed83c09-e66dbcfb
/dev/sdc1  WWID:   1ATA_VBOX_HARDDISK_VB2ed83c09-e66dbcfb
..
--> Of course WWIDs for partitions and for the complete disk are identical 

 

Create UDEV for a WWID identified SCSI device

  • Note in this sample we only change owner, group and protection for a disk device /dev/sdX
# cat 99-oracle-asmdevices.rules
KERNEL=="sd*", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="14f504e46494c45523264556151442d5261336d2d566e4250", OWNER="grid", GROUP="asmadmin", MODE="0660"

# ls -ls /dev/sdr
0 brw-rw----. 1 grid asmadmin 65, 16 Mar 19 14:42 /dev/sdr

Reload and Restart the udev rules 
# udevadm control --reload-rules
# start_udev
Starting udev:                                             [  OK  ]
Verify disk protections:
# ls -ltr /dev/asm*
brw-rw----. 1 grid asmadmin   8,  17 Mar 15 10:03 /dev/asmdisk1_udev_sdb1
brw-rw----. 1 grid asmadmin   8,  33 Mar 15 10:03 /dev/asmdisk2_udev_sdc1

Redistribute   99-oracle-asmdevices.rules file to all cluster nodes and restat udev echo system on these nodes
# scp 99-oracle-asmdevices.rules grac42:/etc/udev/rules.d
# scp 99-oracle-asmdevices.rules grac43:/etc/udev/rules.d

On each RAC node
# udevadm control --reload-rules
# start_udev
# ls -ltr /dev/asm*
brw-rw----. 1 grid asmadmin   8,  17 Mar 15 10:03 /dev/asmdisk1_udev_sdb1
brw-rw----. 1 grid asmadmin   8,  33 Mar 15 10:03 /dev/asmdisk2_udev_sdc1

UDev rules for a disk partition using /sbin/scsi_id ( prefered mothode as we can change the NAME )

  • Note this sample maps:   /dev/sdb1 to /dev/asmdisk1_udev_sdb1, …
# cat 99-oracle-asmdevices.rules
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VB81c4f844-94203a15", NAME=
"asmdisk1_udev_sdb1", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VB2ed83c09-e66dbcfb", NAME=
"asmdisk1_udev_sdc1", OWNER="grid", GROUP="asmadmin", MODE="0660"

# ls -l /dev/asmdisk1_udev_sdb1 /dev/asmdisk1_udev_sdc1
brw-rw----. 1 grid asmadmin 8, 17 Mar 19 13:53 /dev/asmdisk1_udev_sdb1
brw-rw----. 1 grid asmadmin 8, 33 Mar 19 13:53 /dev/asmdisk1_udev_sdc1

 

Reference:   

  •  How To Setup Partitioned Linux Block Devices Using UDEV (Non-ASMLIB) And Assign Them To ASM? (Doc ID 1528148.1)
  • Do you need asmlib?

One thought on “Configure udev rules for ASM devices”

  1. ##I really would like to resolve a problem, I try to use udevadm command in Redhat 7.4 to bind harddisk, my cfgfile is :99-oracle-asmdevices.rules
    ##CONTENT:
    KERNEL==”sdb1″, SUBSYSTEM==”block”, PROGRAM==”/sbin/scsi_id –whitelisted –replace-whitespace –device=/dev/sdb1″, RESULT==”36000c292c21a43b06c2620cc3d984333″, NAME=”asm-ocrdisk1″, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″
    KERNEL==”sdc1″, SUBSYSTEM==”block”, PROGRAM==”/sbin/scsi_id –whitelisted –replace-whitespace –device=/dev/sdc1″, RESULT==”36000c29e747adab0ea18c67266c8a465″, NAME=”asm-redodisk1″, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″
    KERNEL==”sdd1″, SUBSYSTEM==”block”, PROGRAM==”/sbin/scsi_id –whitelisted –replace-whitespace –device=/dev/sdd1″, RESULT==”36000c291629784819912f0ba700bcce0″, NAME=”asm-archdisk1″, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″
    KERNEL==”sde1″, SUBSYSTEM==”block”, PROGRAM==”/sbin/scsi_id –whitelisted –replace-whitespace –device=/dev/sde1″, RESULT==”36000c293e35e2da58a3ffe5fabcbfcf9″, NAME=”asm-datadisk1″, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″
    ##When I user “udevadm test /dev/sdb1”, result is below:———————>>>>
    Reading rules file: /etc/udev/rules.d/99-oracle-asmdevices.rules
    Reading rules file: /usr/lib/udev/rules.d/99-qemu-guest-agent.rules
    Reading rules file: /usr/lib/udev/rules.d/99-systemd.rules
    Reading rules file: /usr/lib/udev/rules.d/99-vmware-scsi-udev.rules
    Reading rules file: /usr/lib/udev/rules.d/rdma-ndd.rules
    rules contain 393216 bytes tokens (32768 * 12 bytes), 34495 bytes strings
    32062 strings (267040 bytes), 28923 de-duplicated (235685 bytes), 3140 trie nodes used
    unable to open device ‘/sys/dev/sdb1’
    Unload module index
    Unloaded link configuration context.
    #make it effective and nothing effect!
    [root@rac01 rules.d]# udevadm control -R
    [root@rac01 rules.d]# ll /dev/asm*
    ls: cannot reached /dev/asm*: no suck file or directory.

Leave a Reply

Your email address will not be published. Required fields are marked *