Oracle Infrastructure Series, part 8. Previous: part 7, DM-Multipath for shared storage. Next up, part 9: ASMLib v3 in depth, including labeling disks with oracleasm createdisk and migrating off the ASM Filter Driver.
A RAC node can reboot with /dev/sdb and /dev/sdc swapped, with the multipath devices owned by root:disk, or with one node calling a LUN sdf while another calls it sdk. ASM does not care what the device is called, but it does insist on two things: the disks must be readable and writable by the Grid Infrastructure owner every time the machine boots, and every node must find the same disks with the same discovery string. This post covers the two supported ways to get there on Oracle Linux 9, plain udev rules and Oracle ASMLib v3, explains why the ASM Filter Driver (AFD) is a dead end for new builds, and helps you pick one for the cluster we are building in this series.
The udev method works unchanged on Oracle Linux, RHEL, Rocky Linux, AlmaLinux and CentOS Stream 9, because udev and device-mapper-multipath are the same on all of them. ASMLib v3 is an Oracle Linux feature with Oracle-supplied packages. It builds on the LUNs we set up in part 7, DM-Multipath for shared storage, so read that post first.
The three options at a glance
| udev rules | Oracle ASMLib v3 | ASM Filter Driver (AFD) | |
|---|---|---|---|
| What it does | Sets owner, group and mode on the device node at boot; optionally adds a stable symlink | Writes an ASM label on each disk, hands ASM disks to the grid user and scans for them; optional I/O filter that rejects writes not made by ASM | Same idea as ASMLib, built into Grid Infrastructure |
| Discovery string | /dev/mapper/data* or /dev/oracleasm/* symlinks | ORCL:* (or /dev/oracleasm/disks/*) | AFD:* |
Protects against accidental dd over an ASM disk | No | Yes, with the I/O filter (UEK R7 or later, or RHCK on Oracle Linux 9) | Not on kernel 5.14 and later: filtering is disabled |
| Works on RHEL, Rocky, AlmaLinux, CentOS | Yes | Oracle Linux only | Only where it still builds |
| Status | Supported, documented by Oracle as manual device persistence | Supported and the replacement Oracle recommends | Deprecated in 19c. Oracle’s documentation describes it as desupported from 23ai (Grid Infrastructure notes) and lists it as desupported on Linux and Solaris in Oracle AI Database 26ai |
| Needs software on every node | No | oracleasm-support, oracleasmlib, a sysconfig file, a service | Installed and managed by Grid Infrastructure |
On kernels 5.14 and later (every Oracle Linux 9 kernel, RHCK and UEK alike) the ASM Filter Driver’s filtering is already switched off, and Oracle’s documentation tells you to move to ASMLib v3 for the same functionality. So for a new Oracle Linux 9 build, AFD is not a choice. If you inherit a cluster that already uses AFD: disks, part 9 walks through the migration to ASMLib v3. Earlier posts in this series that mention AFD only do so to explain the history.
Which one should you use?
- Oracle Linux 9, Oracle supports the stack, and you want the accidental-overwrite protection: ASMLib v3. It is the option Oracle points to, and the I/O filter stops a stray
ddormkfsfrom wiping a disk group member. - You run Rocky Linux, AlmaLinux, RHEL or CentOS Stream, or you want the fewest moving parts: udev rules on top of DM-Multipath. It is plain, auditable, and is what Oracle’s own installation guide calls manual device persistence.
- Mixed environments, or you cannot install extra packages on the database servers: udev.
- Pick one per cluster and use it on every node. Do not mix ASMLib labels and raw udev paths in the same disk group.
For the rest of this series the sample lab keeps using the DM-Multipath aliases from part 7, DM-Multipath for shared storage (crs01 to crs03, data01, reco01) and Grid Infrastructure running as grid with the asmadmin group. The commands show both approaches so you can choose.
Prerequisites
- Oracle Linux 9 prepared as in part 3, preparing Oracle Linux 9, with the
griduser and theasmadmingroup (gid 54329) present on every node. - Shared LUNs visible on every node, preferably already aggregated with DM-Multipath as in part 7, DM-Multipath for shared storage.
- Blank LUNs: no partition table, file system, LVM physical volume or old ASM header you still need. Check with
blkidandlsblk -f. - Root access on all nodes. Nothing here is destructive until you run
oracleasm createdisk.
Option A: persistent naming with udev rules
Step 1: Find the stable identifier of each disk
The only identifier that never changes is the LUN’s WWID. For every disk, take it from scsi_id (or from the multipath map). Note the path: on Oracle Linux 9 it is /usr/lib/udev/scsi_id. The /sbin/scsi_id in older documentation does not exist on EL9, and the old -s sysfs option was removed.
[root@rac1 ~]# /usr/lib/udev/scsi_id -g -u -d /dev/sdb
36000d31000e44200000000000000001a
[root@rac1 ~]# multipathd show maps format "%n %w"
name uuid
crs01 36000d31000e44200000000000000001a
crs02 36000d31000e44200000000000000001b
crs03 36000d31000e44200000000000000001c
data01 36000d31000e44200000000000000002a
reco01 36000d31000e44200000000000000003a
The value must be identical on every node. If one node reports a different WWID, you are not looking at the same LUN, and ASM will not be able to use it as a shared disk.
Step 2: Write the rule file
For multipath devices (the normal RAC case) match on the device-mapper name. This is the same rule used in part 7, and it is all you need:
[root@rac1 ~]# cat /etc/udev/rules.d/99-oracle-asm-mpath.rules
# Multipath devices: match on the device-mapper name (aliases from multipath.conf)
ACTION=="add|change", KERNEL=="dm-*", ENV{DM_NAME}=="crs0*|data0*|reco0*", OWNER="grid", GROUP="asmadmin", MODE="0660"
If a LUN is a single path (a virtual machine disk, a test cluster, or a direct-attached disk) there is no map to match, so match on the WWID instead. The second rule is for a partition: it checks the parent disk’s WWID and the partition number. The SYMLINK gives you a stable name that you can use in the ASM discovery string.
[root@rac1 ~]# cat /etc/udev/rules.d/99-oracle-asm-scsi.rules
# Single-path whole disks (no multipath): match the SCSI WWID
ACTION=="add|change", SUBSYSTEM=="block", KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", ENV{DM_MULTIPATH_DEVICE_PATH}!="1", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$name", RESULT=="36000d31000e44200000000000000001a", SYMLINK+="oracleasm/crs01", OWNER="grid", GROUP="asmadmin", MODE="0660"
# Partitions: match the parent disk's WWID plus the partition number
ACTION=="add|change", SUBSYSTEM=="block", KERNEL=="sd*[0-9]", ENV{DEVTYPE}=="partition", ENV{DM_MULTIPATH_DEVICE_PATH}!="1", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="36000d31000e44200000000000000002a", ENV{ID_PART_ENTRY_NUMBER}=="1", SYMLINK+="oracleasm/data01", OWNER="grid", GROUP="asmadmin", MODE="0660"
ENV{DM_MULTIPATH_DEVICE_PATH}!="1"keeps the rule from matching the individual paths of a multipath LUN. Without it,sdb,sdh,sdnandsdtwould all share one WWID and all becomeoracleasm/crs01candidates, and ASM would see the same disk several times.- File name
99-makes the rule run after the system rules that importDM_NAMEand the SCSI identifiers. - Never use
/dev/sdXnames in a rule or in ASM. They change between boots and between nodes. - Oracle’s documentation example uses
KERNEL=="sdb1"withPROGRAM=="/sbin/scsi_id"and aBUS=="scsi"match. That is the older style. The rules above do the same thing with current udev syntax and the correct path on EL9.
Step 3: Check the rule syntax before you load it
On Oracle Linux 9 (systemd 252), udevadm verify parses rule files and catches typos. udevadm test then shows what udev would do to one specific device:
[root@rac1 ~]# udevadm verify /etc/udev/rules.d/99-oracle-asm-mpath.rules /etc/udev/rules.d/99-oracle-asm-scsi.rules
2 udev rules files have been checked.
Success: 2
Fail: 0
[root@rac1 ~]# udevadm test /sys/class/block/dm-2 2>&1 | grep -E "OWNER|GROUP|MODE|DM_NAME"
dm-2: OWNER 54331 /etc/udev/rules.d/99-oracle-asm-mpath.rules:2
dm-2: GROUP 54329 /etc/udev/rules.d/99-oracle-asm-mpath.rules:2
dm-2: MODE 0660 /etc/udev/rules.d/99-oracle-asm-mpath.rules:2
ENV{DM_NAME}=crs01
If verify reports Unknown user or Unknown group, the grid user or asmadmin group does not exist on that node yet. Create them first, or the rule silently does nothing useful.
Step 4: Copy to every node, reload and trigger
[root@rac1 ~]# for n in rac2; do scp /etc/udev/rules.d/99-oracle-asm-*.rules root@$n:/etc/udev/rules.d/; done
[root@rac1 ~]# udevadm control --reload-rules
[root@rac1 ~]# udevadm trigger --type=devices --action=change --subsystem-match=block
[root@rac1 ~]# ls -lL /dev/mapper/crs0* /dev/mapper/data01 /dev/mapper/reco01
brw-rw----. 1 grid asmadmin 253, 2 Nov 22 10:02 /dev/mapper/crs01
brw-rw----. 1 grid asmadmin 253, 3 Nov 22 10:02 /dev/mapper/crs02
brw-rw----. 1 grid asmadmin 253, 4 Nov 22 10:02 /dev/mapper/crs03
brw-rw----. 1 grid asmadmin 253, 5 Nov 22 10:02 /dev/mapper/data01
brw-rw----. 1 grid asmadmin 253, 6 Nov 22 10:02 /dev/mapper/reco01
Repeat on every node, and then reboot one node (not all of them) to prove that ownership comes back without anyone running a command. That reboot test is the whole point of persistence.
Step 5: Confirm what ASM will discover
Use kfod from the unzipped Grid Infrastructure home. For multipath devices the discovery string is the set of /dev/mapper aliases. For the symlink rules it is /dev/oracleasm/*:
[grid@rac1 ~]$ /u01/app/19.0.0/grid/bin/kfod disks=all asm_diskstring='/dev/mapper/crs*,/dev/mapper/data*,/dev/mapper/reco*'
--------------------------------------------------------------------------------
Disk Size Path User Group
================================================================================
1: 10240 MB /dev/mapper/crs01 grid asmadmin
2: 10240 MB /dev/mapper/crs02 grid asmadmin
3: 10240 MB /dev/mapper/crs03 grid asmadmin
4: 512000 MB /dev/mapper/data01 grid asmadmin
5: 512000 MB /dev/mapper/reco01 grid asmadmin
--------------------------------------------------------------------------------
Group ownership: asmadmin or asmdba?
The sample lab uses grid:asmadmin, matching the groups created in part 3 (the grid user is also a member of asmdba, and the oracle user is added to asmdba there). Oracle’s documentation for manual device persistence shows asmdba as the group, and its notes on deconfiguring AFD say that when you upgrade Grid Infrastructure from 19c to 23ai or 26ai the ASM devices must be owned by the asmdba group. The group that matters is whichever one your grid and database owners belong to so that they can open the devices. Check the group memberships (id grid, id oracle) against the current installation guide for the release you are installing, and if you are planning a 19c to 23ai/26ai upgrade, change GROUP in the rule to asmdba in the same maintenance window as the upgrade.
Option B: Oracle ASMLib v3
ASMLib v3 is a rewrite for current kernels. On UEK R7 and UEK 8 it needs no kernel module, because it talks to the disks through io_uring. On Oracle Linux 9 with the Red Hat compatible kernel (RHCK) no driver is needed either, but io_uring must be enabled. On Oracle Linux 8 with RHCK you install kmod-redhat-oracleasm. The I/O filter is built on BPF and works with UEK R7 and later, or with RHCK on Oracle Linux 9.
Step 1: Install the packages
oracleasm-support is in the ol9_addons repository. oracleasmlib comes from the Oracle ASMLib download page for Oracle Linux 9 (or from the Oracle ASMLIB channel on ULN). Install both on every node:
[root@rac1 ~]# dnf config-manager --enable ol9_addons
[root@rac1 ~]# dnf install -y oracleasm-support
[root@rac1 ~]# rpm -ivh oracleasmlib-3.1.3-1.el9.x86_64.rpm
[root@rac1 ~]# rpm -q oracleasm-support oracleasmlib
oracleasm-support-3.1.1-6.el9.x86_64
oracleasmlib-3.1.3-1.el9.x86_64
The exact versions change over time. Use the newest 3.1.x on the download page; Oracle states that 3.0 users should move to 3.1. If you run RHCK instead of UEK, enable io_uring for Oracle processes:
[root@rac1 ~]# cat /etc/sysctl.d/io_uring.conf
kernel.io_uring_disabled = 1
kernel.io_uring_group = 54329
[root@rac1 ~]# sysctl -p /etc/sysctl.d/io_uring.conf
That restricts io_uring to members of one group; the number must be the numeric ID of the group you give to oracleasm configure in the next step (54329 is asmadmin in this series). Setting kernel.io_uring_disabled = 0 enables it for everyone, which is simpler but a wider exposure.
Step 2: Configure the service
[root@rac1 ~]# oracleasm configure -i
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting <ENTER> without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: grid
Default group to own the driver interface []: asmadmin
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Maximum number of disks that may be used in ASM system [2048]: 2048
Enable iofilter if kernel supports it (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
[root@rac1 ~]# systemctl enable --now oracleasm
The answers are stored in /etc/sysconfig/oracleasm. Oracle recommends changing it only with oracleasm configure, and says that configuration changes do not take effect immediately: stop the database and ASM processes first, and expect a reboot to apply them.
Step 3: Make ASMLib prefer the multipath devices
ASM cannot cope with seeing the same disk twice, and a multipath LUN appears as four sd paths plus one dm device. ASMLib picks the first device it finds, so tell it to look at dm devices first and ignore sd devices. These two settings are the ones that matter when you use ASMLib on top of DM-Multipath:
[root@rac1 ~]# grep -E "SCANORDER|SCANEXCLUDE" /etc/sysconfig/oracleasm
ORACLEASM_SCANORDER="dm"
ORACLEASM_SCANEXCLUDE="sd"
Both settings take kernel device name prefixes, such as dm, not /dev/mapper aliases. Excluding sd also hides any single-path SCSI disk from ASMLib, so if you mix multipath and non-multipath LUNs, list the non-multipath ones another way.
Step 4: Label, scan and discover
Labeling is part 9’s main subject, so here is only the shape of it. You label each disk once, from one node, and every other node just scans:
[root@rac1 ~]# oracleasm createdisk DATA01 /dev/mapper/data01
Writing disk header: done
Instantiating disk: done
[root@rac2 ~]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
Instantiating disk "DATA01"
[root@rac2 ~]# oracleasm listdisks
DATA01
[root@rac2 ~]# oracleasm status
Checking if the oracleasm kernel module is loaded: no (Not required with kernel 5.14.0)
Checking if /dev/oracleasm is mounted: no (Not required with kernel 5.14.0)
Checking which I/O Interface is in use: io_uring (KABI_V3)
Checking if ASMLIB can be loaded: yes
Checking if io_uring is enabled: yes
Checking if io_uring is accessible to the configured DB user: yes
Checking if ASM disks have the correct ownership and permissions: yes
Checking if ASM I/O filter is set up: yes
oracleasm discover is the ASMLib equivalent of kfod: it lists the disks that match a discovery string, with the string you will give the installer being ORCL:*.
19c, 23ai and 26ai differences
- 19c on Oracle Linux 9 needs Release Update 19.19 or later (covered in part 1, the overview). ASMFD still exists in the product but is deprecated, and on kernel 5.14 and later its filtering is off. Use udev or ASMLib v3.
- 23ai desupports ASMFD for Grid Infrastructure. Before upgrading from 19c, deconfigure AFD and check device group ownership as described above.
- 26ai desupports ASMFD on Linux and Solaris. ASMLib v3 and udev both continue to work. Oracle’s documentation for ASMLib v3 calls out UEK R7 and later or Oracle Linux 9 RHCK as the platforms for the I/O filter.
Verification checklist
- Every node reports the same WWID for the same LUN (
scsi_idormultipathd show maps format "%n %w"). - Device nodes (
ls -lL) are owned by the Grid Infrastructure owner and group, mode 0660, on every node. - After rebooting one node, ownership is correct without running anything by hand.
kfod disks=all asm_diskstring=...(ororacleasm discover) lists each disk exactly once.- No
/dev/sdXpath appears in the discovery string, and ASM does not see the same disk under two names.
Troubleshooting and gotchas
- Ownership is
root:diskafter a reboot: the rule does not match. Runudevadm info --query=property --name=/dev/mapper/crs01 | grep DM_NAMEand compare with the rule, thenudevadm test /sys/class/block/dm-2. - Rule applies to the wrong device, or ASM sees duplicates: a WWID-based rule without
ENV{DM_MULTIPATH_DEVICE_PATH}!="1"matched every path of a multipath LUN. - Ownership breaks after a reboot but the rule looked right: the rule matched
KERNEL=="dm-2"or anotherdm-Nnumber. Those numbers change between boots and between nodes. MatchDM_NAME(orDM_UUID) as above, never thedm-Nnode. udevadm verifysays Unknown user or group:gridorasmadminis missing on that node, or has a different ID.- ASMLib:
oracleasm createdisksays the device is already in use or fails on a multipath member: label thedmdevice, not ansdpath, and check thatORACLEASM_SCANEXCLUDEdoes not hide it. - ASMLib:
oracleasm statusreports io_uring is not enabled or not accessible: on Oracle Linux 9 RHCK setkernel.io_uring_disabledas shown above and make sure the group ID matches the one you configured. - ASMLib: disks are visible on the node that labeled them but not on the others: run
oracleasm scandiskson the other nodes and checkORACLEASM_SCAN_DIRECTORIESand that the same LUNs are present. - You inherited
AFD:disks: do not runafd_deconfigurecasually. It needs the Clusterware stack stopped on the node and a planned rolling procedure, which is the topic of part 9.
What was tested
The rule syntax in this post was checked with udevadm verify (systemd 257, on a Debian machine, with the grid and asmadmin names swapped for existing accounts so the parser would not stop on them). All three rules parsed with no errors. I did not run these steps on a live Oracle Linux 9 RAC cluster with shared storage. The host names, WWIDs, sizes and command output are the sample values from the lab used throughout this series, not captured from production hardware. The oracleasm commands, configuration questions and status checks follow Oracle’s ASMLIB documentation. Test on a non-production cluster first, and reboot a node to prove persistence.
Oracle Infrastructure Series: this is part 8. Previous: part 7, DM-Multipath for shared storage. Earlier: part 6, DNS and GNS for SCAN, part 5, HAIP vs bonding for the private interconnect, part 4, bonding the public network, part 3, preparing Oracle Linux 9, part 2, planning the RAC cluster and part 1, the overview. Next is part 9, ASMLib v3 in depth: labeling disks, I/O filtering and migrating from the ASM Filter Driver.
References: Oracle Installing and Upgrading Oracle ASMLIB and Configuring Oracle ASMLIB; Oracle Database Configuring Device Persistence Manually for Oracle ASM; Migrating from Oracle ASM Filter Driver to Oracle ASMLib; Oracle Database Changes, Desupports, and Deprecations; the udev(7) and udevadm(8) man pages.
