In case you want to fire up an Oracle 21c ASM instance on your Oracle Enterprise Linux 8.7, 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 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_SERIAL which is the identifier world wide name. E.g. for the disk /dev/sdc it will be ID_SERIAL_SHORT=VB239dad2e-dd88e62e
-- list all available ASM disks # fdisk -l |grep "8 GiB" Disk /dev/sdh: 8 GiB, 8589934592 bytes, 16777216 sectors Disk /dev/sdi: 8 GiB, 8589934592 bytes, 16777216 sectors Disk /dev/sdg: 8 GiB, 8589934592 bytes, 16777216 sectors Disk /dev/sdf: 8 GiB, 8589934592 bytes, 16777216 sectors Disk /dev/sde: 8 GiB, 8589934592 bytes, 16777216 sectors Disk /dev/sdd: 8 GiB, 8589934592 bytes, 16777216 sectors Disk /dev/sdc: 8 GiB, 8589934592 bytes, 16777216 sectors -- DATA # udevadm info --query=all --name=/dev/sdc | egrep "WWN|SERIAL" E: ID_SERIAL=VBOX_HARDDISK_VB239dad2e-dd88e62e E: ID_SERIAL_SHORT=VB239dad2e-dd88e62e E: SCSI_IDENT_SERIAL=VB239dad2e-dd88e62e # udevadm info --query=all --name=/dev/sdd | egrep "WWN|SERIAL" E: ID_SERIAL=VBOX_HARDDISK_VB2bc4f9e3-fab966f0 E: ID_SERIAL_SHORT=VB2bc4f9e3-fab966f0 E: SCSI_IDENT_SERIAL=VB2bc4f9e3-fab966f0 # udevadm info --query=all --name=/dev/sde | egrep "WWN|SERIAL" E: ID_SERIAL=VBOX_HARDDISK_VB9d41cd03-3ae5e7b9 E: ID_SERIAL_SHORT=VB9d41cd03-3ae5e7b9 E: SCSI_IDENT_SERIAL=VB9d41cd03-3ae5e7b9 -- FRA # udevadm info --query=all --name=/dev/sdf | egrep "WWN|SERIAL" E: ID_SERIAL=VBOX_HARDDISK_VB194629d9-518a16f4 E: ID_SERIAL_SHORT=VB194629d9-518a16f4 E: SCSI_IDENT_SERIAL=VB194629d9-518a16f4 # udevadm info --query=all --name=/dev/sdg | egrep "WWN|SERIAL" E: ID_SERIAL=VBOX_HARDDISK_VB879bdafe-77d7f762 E: ID_SERIAL_SHORT=VB879bdafe-77d7f762 E: SCSI_IDENT_SERIAL=VB879bdafe-77d7f762 # udevadm info --query=all --name=/dev/sdh | egrep "WWN|SERIAL" E: ID_SERIAL=VBOX_HARDDISK_VB7c40149d-17ab87d0 E: ID_SERIAL_SHORT=VB7c40149d-17ab87d0 E: SCSI_IDENT_SERIAL=VB7c40149d-17ab87d0 # udevadm info --query=all --name=/dev/sdi | egrep "WWN|SERIAL" E: ID_SERIAL=VBOX_HARDDISK_VBd95c6923-f3ce09a2 E: ID_SERIAL_SHORT=VBd95c6923-f3ce09a2 E: SCSI_IDENT_SERIAL=VBd95c6923-f3ce09a2
After we have identified the ID_SERIAL’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 # disk /dev/sdc KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_SERIAL}=="VBOX_HARDDISK_VB239dad2e-dd88e62e", SYMLINK+="oracleasm/asmdisk01", OWNER="grid", GROUP="asmdba", MODE="0660" ,OPTIONS:="nowatch" # disk /dev/sdd KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_SERIAL}=="VBOX_HARDDISK_VB2bc4f9e3-fab966f0", SYMLINK+="oracleasm/asmdisk02", OWNER="grid", GROUP="asmdba", MODE="0660" ,OPTIONS:="nowatch" # disk /dev/sde KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_SERIAL}=="VBOX_HARDDISK_VB9d41cd03-3ae5e7b9", SYMLINK+="oracleasm/asmdisk03", OWNER="grid", GROUP="asmdba", MODE="0660" ,OPTIONS:="nowatch" # disk /dev/sdf KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_SERIAL}=="VBOX_HARDDISK_VB194629d9-518a16f4", SYMLINK+="oracleasm/asmdisk04", OWNER="grid", GROUP="asmdba", MODE="0660" ,OPTIONS:="nowatch" # disk /dev/sdg KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_SERIAL}=="VBOX_HARDDISK_VB879bdafe-77d7f762", SYMLINK+="oracleasm/asmdisk05", OWNER="grid", GROUP="asmdba", MODE="0660" ,OPTIONS:="nowatch" # disk /dev/sdh KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_SERIAL}=="VBOX_HARDDISK_VB7c40149d-17ab87d0", SYMLINK+="oracleasm/asmdisk06", OWNER="grid", GROUP="asmdba", MODE="0660" ,OPTIONS:="nowatch" # disk /dev/sdi KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_SERIAL}=="VBOX_HARDDISK_VBd95c6923-f3ce09a2", SYMLINK+="oracleasm/asmdisk07", OWNER="grid", GROUP="asmdba", MODE="0660" ,OPTIONS:="nowatch"
HINT: The “nowatch” option prevents the “systemd-udevd” of consuming too much CPU. For more information, check the following MOS note.
Oracle Linux: Udev Rules is Continuously Getting Reloaded Causing High CPU Usage (Doc ID 2737369.1)
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 /dev/oracleasm/ total 0 lrwxrwxrwx 1 root root 6 Apr 28 10:56 asmdisk01 -> ../sdc lrwxrwxrwx 1 root root 6 Apr 28 10:56 asmdisk02 -> ../sdd lrwxrwxrwx 1 root root 6 Apr 28 10:56 asmdisk03 -> ../sde lrwxrwxrwx 1 root root 6 Apr 28 10:56 asmdisk04 -> ../sdf lrwxrwxrwx 1 root root 6 Apr 28 10:56 asmdisk05 -> ../sdg lrwxrwxrwx 1 root root 6 Apr 28 10:56 asmdisk06 -> ../sdh lrwxrwxrwx 1 root root 6 Apr 28 10:56 asmdisk07 -> ../sdi # ls -l /dev | grep asmdba brw-rw---- 1 grid asmdba 8, 32 Apr 28 10:56 sdc brw-rw---- 1 grid asmdba 8, 48 Apr 28 10:56 sdd brw-rw---- 1 grid asmdba 8, 64 Apr 28 10:56 sde brw-rw---- 1 grid asmdba 8, 80 Apr 28 10:56 sdf brw-rw---- 1 grid asmdba 8, 96 Apr 28 10:56 sdg brw-rw---- 1 grid asmdba 8, 112 Apr 28 10:56 sdh brw-rw---- 1 grid asmdba 8, 128 Apr 28 10:56 sdi
Now you are ready to fire up your Oracle ASM instance and use these candidate ASM disks. HINT: If these candidate ASM disks have be used before, you might want to clean out the first few blocks, so that the disks can be reused again.
# dd if=/dev/zero of=/dev/sdc bs=8192 count=4 4+0 records in 4+0 records out 32768 bytes (33 kB, 32 KiB) copied, 0.000981887 s, 33.4 MB/s # dd if=/dev/zero of=/dev/sdd bs=8192 count=4 4+0 records in 4+0 records out 32768 bytes (33 kB, 32 KiB) copied, 0.000235744 s, 139 MB/s # dd if=/dev/zero of=/dev/sde bs=8192 count=4 4+0 records in 4+0 records out 32768 bytes (33 kB, 32 KiB) copied, 0.00137574 s, 23.8 MB/s # dd if=/dev/zero of=/dev/sdf bs=8192 count=4 4+0 records in 4+0 records out 32768 bytes (33 kB, 32 KiB) copied, 0.000298288 s, 110 MB/s # dd if=/dev/zero of=/dev/sdg bs=8192 count=4 4+0 records in 4+0 records out 32768 bytes (33 kB, 32 KiB) copied, 0.000249764 s, 131 MB/s # dd if=/dev/zero of=/dev/sdh bs=8192 count=4 4+0 records in 4+0 records out 32768 bytes (33 kB, 32 KiB) copied, 0.000268358 s, 122 MB/s # dd if=/dev/zero of=/dev/sdi bs=8192 count=4 4+0 records in 4+0 records out 32768 bytes (33 kB, 32 KiB) copied, 0.00023732 s, 138 MB/s
Conclusion
Setting up Oracle ASM udev rules is not so complicated. All you need is the udevadm command and editing one file.