How to setup UDEV instead of ASM libraries for ASM on Linux

In this post I am going to share how to use UDEV on Linux server for ASM disk in place for ASMlib.
It will help to directly allot the raw disk to your asm disk group.It can be used in Red Hat, Oracle, Centos Linux variants using UDEV.

Udev is the mechanism used to create and name /dev device nodes corresponding to the devices that are present in the system. Udev uses matching information provided by sysfs with rules provided by the user to dynamically add the required device nodes.

Steps to use udev for ASM

1. Attach a raw disk to the server.

2. Use lsblk or fdisk -l command to find the new added disk names.



3. Find the ID_Serial for each associated disk, if we directly use the disk name it might get chnaged after the server reboot.

udevadm info --query=property /dev/sdg
udevadm info --query=property /dev/sde
udevadm info --query=property /dev/sdf
udevadm info --query=property /dev/sdc
udevadm info --query=property /dev/sdd

4. Go to cd /etc/udev/rules.d directory and add the new disk details in file 99-oracle-asmdevices.rules as below. Make sure to update ID_SERIAL with your correct value and disk owner and group should be correct based on the env. Also I will give a virtual name/symbolink for eash disk as oraasm01/02/03 etc.

ACTION=="add|change", SUBSYSTEM=="block", ENV{ID_SERIAL}=="36000c297a90d6a9681b1d2a5a1b88568", GROUP="dba", SYMLINK+="oraasm01",OWNER="oraasm", MODE="0660"
ACTION=="add|change", SUBSYSTEM=="block", ENV{ID_SERIAL}=="36000c29906aa418e9822a0947ce9ad22", GROUP="dba", SYMLINK+="oraasm02",OWNER="oraasm", MODE="0660"
ACTION=="add|change", SUBSYSTEM=="block", ENV{ID_SERIAL}=="36000c291823fef46b990dbc1fe7bebdf", GROUP="dba", SYMLINK+="oraasm03",OWNER="oraasm", MODE="0660"
ACTION=="add|change", SUBSYSTEM=="block", ENV{ID_SERIAL}=="36000c2944397980b1b7f91a3d0c99e56", GROUP="dba", SYMLINK+="oraasm04",OWNER="oraasm", MODE="0660"
ACTION=="add|change", SUBSYSTEM=="block", ENV{ID_SERIAL}=="36000c2954d200a2927a1e815945e603d", GROUP="dba", SYMLINK+="oraasm05",OWNER="oraasm", MODE="0660"

5. Reload the udev rules to identify the new disks.

udevadm control --reload-rules
udevadm trigger --type=devices --action=change

# #OL5
# /sbin/udevcontrol reload_rules

# #OL6 and OL7
# udevadm control --reload-rules

# #OL5 and OL6 : Not needed for OL7
# /sbin/start_udev

6. Verify the disk permissions and permissions

ls -l /dev/oraasm05
ls -l /dev/oraasm03
ls -l /dev/oraasm04
ls -l /dev/oraasm01
ls -l /dev/oraasm02

7. Make sure the ASM disk string should be set as  asm_diskstring='/dev/ora*' to identify the disks.

8. Attach the new disks to the diskgroup in asm now.

alter diskgroup TEST add disk '/dev/oraasm01' rebalance power 5;


SQL> set pages 40000 lines 120
col PATH for a30
----------- ------- ------------ ------- -------- ------------------------------
          4 CACHED  MEMBER       ONLINE  NORMAL   /dev/oraasm05
          2 CACHED  MEMBER       ONLINE  NORMAL   /dev/oraasm03
          3 CACHED  MEMBER       ONLINE  NORMAL   /dev/oraasm04
          0 CACHED  MEMBER       ONLINE  NORMAL   /dev/oraasm01
          1 CACHED  MEMBER       ONLINE  NORMAL   /dev/oraasm02