In case you want to fire up an Oracle 19c ASM instance on your CentOS/RHEL 8.2, you have a few possibilities. E.g. you could use the asmlib driver or you can create your udev rules your own. (There might be some more possibilites, but these are out of scope for this blog post)
Creating your own udev rules has the great advantage of eliminating another software layer. ASM itself is complex enough, and from my point of view, you want to get rid of as many complexity layers as possible, and asmlib is one of those.
In my setup, I do have 7 virtual NVME disks. 3 will be assigned to the +DATA diskgroup and 4 will be assigned to the +FRA diskgroup.
To create these Oracle ASM disks, you simply need to follow 3 steps:
- Identify the devices/disks
- Create the udev rules
- Apply the udev rules
Lets start by identifying the disks ID_WWN which is the identifier world wide name. E.g. for the disk /dev/nvme0n1 it will be ID_WWN=eui.2ead9d23bd90e943aa6aa5722ee688dd
-- DATA # udevadm info --query=all --name=/dev/nvme0n1 | egrep "WWN|SERIAL" E: ID_SERIAL=ORCL-VBOX-NVME-VER12_VB1234-56789 E: ID_SERIAL_SHORT=VB1234-56789 E: ID_WWN=eui.2ead9d23bd90e943aa6aa5722ee688dd <= This is the one we need E: ID_WWN_WITH_EXTENSION=eui.2ead9d23bd90e943aa6aa5722ee688dd # udevadm info --query=all --name=/dev/nvme0n2 | egrep "WWN|SERIAL" E: ID_SERIAL=ORCL-VBOX-NVME-VER12_VB1234-56789 E: ID_SERIAL_SHORT=VB1234-56789 E: ID_WWN=eui.e3f9c42bf69ff74284e4b8f6f066b9fa <= This is the one we need E: ID_WWN_WITH_EXTENSION=eui.e3f9c42bf69ff74284e4b8f6f066b9fa # udevadm info --query=all --name=/dev/nvme0n3 | egrep "WWN|SERIAL" E: ID_SERIAL=ORCL-VBOX-NVME-VER12_VB1234-56789 E: ID_SERIAL_SHORT=VB1234-56789 E: ID_WWN=eui.03cd419de180624cba631dafb9e7e53a <= This is the one we need E: ID_WWN_WITH_EXTENSION=eui.03cd419de180624cba631dafb9e7e53a -- FRA # udevadm info --query=all --name=/dev/nvme0n4 | egrep "WWN|SERIAL" E: ID_SERIAL=ORCL-VBOX-NVME-VER12_VB1234-56789 E: ID_SERIAL_SHORT=VB1234-56789 E: ID_WWN=eui.d92946194b04b9419ab231c9f4168a51 <= This is the one we need E: ID_WWN_WITH_EXTENSION=eui.d92946194b04b9419ab231c9f4168a51 # udevadm info --query=all --name=/dev/nvme0n5 | egrep "WWN|SERIAL" E: ID_SERIAL=ORCL-VBOX-NVME-VER12_VB1234-56789 E: ID_SERIAL_SHORT=VB1234-56789 E: ID_WWN=eui.feda9b87cbee4b489886156262f7d777 <= This is the one we need E: ID_WWN_WITH_EXTENSION=eui.feda9b87cbee4b489886156262f7d777 # udevadm info --query=all --name=/dev/nvme0n6 | egrep "WWN|SERIAL" E: ID_SERIAL=ORCL-VBOX-NVME-VER12_VB1234-56789 E: ID_SERIAL_SHORT=VB1234-56789 E: ID_WWN=eui.9d14407c449b134e9c3403fbd087ab17 <= This is the one we need E: ID_WWN_WITH_EXTENSION=eui.9d14407c449b134e9c3403fbd087ab17 # udevadm info --query=all --name=/dev/nvme0n7 | egrep "WWN|SERIAL" E: ID_SERIAL=ORCL-VBOX-NVME-VER12_VB1234-56789 E: ID_SERIAL_SHORT=VB1234-56789 E: ID_WWN=eui.23695cd9c41912408864bde2a209cef3 <= This is the one we need E: ID_WWN_WITH_EXTENSION=eui.23695cd9c41912408864bde2a209cef3
After we have identified the ID_WWN’s for our ASM disks, we can create the udev rules. Depending on your setup, you might need to adjust the GROUP or the OWNER.
# cat /etc/udev/rules.d/96-storage-asm.rules ACTION=="add|change", ENV{ID_WWN}=="eui.2ead9d23bd90e943aa6aa5722ee688dd", SYMLINK+="oracleasm/asmdisk01", GROUP="dba", OWNER="oracle", MODE="0660" ACTION=="add|change", ENV{ID_WWN}=="eui.e3f9c42bf69ff74284e4b8f6f066b9fa", SYMLINK+="oracleasm/asmdisk02", GROUP="dba", OWNER="oracle", MODE="0660" ACTION=="add|change", ENV{ID_WWN}=="eui.03cd419de180624cba631dafb9e7e53a", SYMLINK+="oracleasm/asmdisk03", GROUP="dba", OWNER="oracle", MODE="0660" ACTION=="add|change", ENV{ID_WWN}=="eui.d92946194b04b9419ab231c9f4168a51", SYMLINK+="oracleasm/asmdisk04", GROUP="dba", OWNER="oracle", MODE="0660" ACTION=="add|change", ENV{ID_WWN}=="eui.feda9b87cbee4b489886156262f7d777", SYMLINK+="oracleasm/asmdisk05", GROUP="dba", OWNER="oracle", MODE="0660" ACTION=="add|change", ENV{ID_WWN}=="eui.9d14407c449b134e9c3403fbd087ab17", SYMLINK+="oracleasm/asmdisk06", GROUP="dba", OWNER="oracle", MODE="0660" ACTION=="add|change", ENV{ID_WWN}=="eui.23695cd9c41912408864bde2a209cef3", SYMLINK+="oracleasm/asmdisk07", GROUP="dba", OWNER="oracle", MODE="0660"
Last but not least, we need to apply the udev rules.
# udevadm control --reload-rules # udevadm trigger --type=devices --action=change
If everything went fine, you should see the correct owner/group membership of your devices and the asmdisk* symbolic links in the /dev/oracleasm directory.
# ls -l | grep nvme0n brw-rw----. 1 oracle dba 259, 0 Oct 27 08:25 nvme0n1 brw-rw----. 1 oracle dba 259, 1 Oct 27 08:24 nvme0n2 brw-rw----. 1 oracle dba 259, 2 Oct 27 08:24 nvme0n3 brw-rw----. 1 oracle dba 259, 3 Oct 27 08:25 nvme0n4 brw-rw----. 1 oracle dba 259, 4 Oct 27 08:24 nvme0n5 brw-rw----. 1 oracle dba 259, 5 Oct 27 08:24 nvme0n6 brw-rw----. 1 oracle dba 259, 6 Oct 27 08:25 nvme0n7 # ls -l total 0 lrwxrwxrwx. 1 root root 10 Oct 27 08:22 asmdisk01 -> ../nvme0n1 lrwxrwxrwx. 1 root root 10 Oct 27 08:20 asmdisk02 -> ../nvme0n2 lrwxrwxrwx. 1 root root 10 Oct 27 08:20 asmdisk03 -> ../nvme0n3 lrwxrwxrwx. 1 root root 10 Oct 27 08:20 asmdisk04 -> ../nvme0n4 lrwxrwxrwx. 1 root root 10 Oct 27 08:20 asmdisk05 -> ../nvme0n5 lrwxrwxrwx. 1 root root 10 Oct 27 08:22 asmdisk06 -> ../nvme0n6 lrwxrwxrwx. 1 root root 10 Oct 27 08:20 asmdisk07 -> ../nvme0n7
Now you are ready to fire up your Oracle ASM instance and use these candidate ASM disks.
Conclusion
Setting up Oracle ASM udev rules is not so complicated. All you need is the udevadm command and editing one file.