I recently had a client express some interest in migrating from UDEV managed devices in Oracle ASM to the ASM Filter Driver.
I’ve covered the benefits of the filter driver in a previous post.
There is a Metalink document describing the migration from ASMLIB to AFD that is quite informative:
ASMFD: How to Migrate ASM Diskgroups from ASMLIB to ASMFD (ASM Filter Driver)
on Oracle Grid Infrastructure (RAC) (Doc ID 2172754.1)
However, I did not see one for UDEV -> AFD. While some of the steps are quite similar, I thought I’d give a step by step on how to perform this conversion so that your storage is fully managed by Oracle and your data protected by filtering.
Scenario:
I have an Oracle Linux 7.9 VM, with 19c Grid stand alone and 19c DB installed, two devices presented for DATA and FRA diskgroups, and links setup with UDEV rules as shown below:
KERNEL==”sd?”, SUBSYSTEM==”block”,PROGRAM==”/usr/lib/udev/scsi_id -g -u -d /dev/$name”,RESULT==”1ATA_Oracle_Linux_7-5_SSD_NF1T2476PMR4S7J305
1Q”,SYMLINK+=”oracleasm/disk1″,OWNER=”oracle”, GROUP=”dba”, MODE=”0660″
KERNEL==”sd?”, SUBSYSTEM==”block”,PROGRAM==”/usr/lib/udev/scsi_id -g -u -d /dev/$name”,RESULT==”1ATA_Oracle_Linux_7-4_SSD_48TVB1ZANCFM3A02JS
2T”,SYMLINK+=”oracleasm/disk2″,OWNER=”oracle”, GROUP=”dba”, MODE=”0660″
I have 2 diskgroups setup (disk1 = DATA, disk2 = FRA):
SQL> select name, state from v$asm_diskgroup;
DISKGROUP STATE
——————— ———–
DATA MOUNTED
FRA MOUNTED
SQL> select path from v$asm_disk;
PATH
———————————-
/dev/oracleasm/disk2
/dev/oracleasm/disk1
This is validation that the Oracle ASM Filter Driver is *not* setup:
[oracle@oracle-linux-7 ~]$ asmcmd afd_state
ASMCMD-9530: The AFD state is ‘NOT INSTALLED’
I have a database named TEST with datafiles on the DATA diskgroup:
SQL> select name from v$datafile;
NAME
————————————————-
+DATA/TEST/DATAFILE/system.257.1094991617
+DATA/TEST/DATAFILE/sysaux.258.1094991619
+DATA/TEST/DATAFILE/undotbs.259.1094991621
+DATA/TEST/DATAFILE/users.261.1094991627
Now we can start the conversion from UDEV to ASM Filter Driver.
First, shutdown the database. Next, shutdown GRID:
[root@oracle-linux-7 init.d]# ./ohasd stop
Stopping Oracle Clusterware stack
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on ‘oracle-linux-7’ has completed
CRS-4133: Oracle High Availability Services has been stopped.
Next – let’s configure and enable the ASM Filter Driver:
[root@oracle-linux-7 init.d]# asmcmd afd_configure -e
AFD-627: AFD distribution files found.
AFD-634: Removing previous AFD installation.
AFD-635: Previous AFD components successfully removed.
AFD-9294: updating file /etc/sysconfig/oracledrivers.conf
AFD-636: Installing requested AFD software.
AFD-637: Loading installed AFD drivers.
AFD-9321: Creating udev for AFD.
AFD-9323: Creating module dependencies – this may take some time.
AFD-9154: Loading ‘oracleafd.ko’ driver.
AFD-649: Verifying AFD devices.
AFD-9156: Detecting control device ‘/dev/oracleafd/admin’.
AFD-638: AFD installation correctness verified.
Modifying resource dependencies – this may take some time.
You can now see the loaded AFD Kernel Module, a loaded AFD state, and the AFD configuration file:
(NOTE: it didn’t add a diskstring by default – you may need to do that – e.g. ‘/dev/sd*’)
[root@oracle-linux-7 init.d]# lsmod | grep afd
oracleafd 214072 0
[root@oracle-linux-7 init.d]# asmcmd afd_state
ASMCMD-9526: The AFD state is ‘LOADED’ and filtering is ‘ENABLED’ on host ‘oracle-linux-7.shared’
[root@oracle-linux-7 init.d]# cat /etc/oracleafd.conf
afd_diskstring=”
afd_filtering=enable
As of now, we have no AFD labeled disks:
[root@oracle-linux-7 init.d]# asmcmd afd_lsdsk
There are no labelled devices.
Let’s take the UDEV managed devices and re-stamp the header as an ASM Filter Driver disk. Note that we need the “migrate” parameter for this header stamp command:
[root@oracle-linux-7 init.d]# asmcmd afd_label DATA1 /dev/sdc –migrate
[root@oracle-linux-7 init.d]# asmcmd afd_label FRA1 /dev/sdd –-migrate
You can now see the active AFD managed disks and their location:
root@oracle-linux-7 init.d]# asmcmd afd_lsdsk
—————————————————
Label Filtering Path
===================================================
DATA1 ENABLED /dev/sdc
FRA1 ENABLED /dev/sdd
[root@oracle-linux-7 init.d]# ls -altr /dev/oracleafd/disks
-rw-rw-r– 1 oracle dba 9 Jan 26 12:49 DATA1
-rw-rw-r– 1 oracle dba 9 Jan 26 12:49 FRA1
Now, it’s time to disable the UDEV management:
[root@oracle-linux-7 init.d]# cd /etc/udev/rules.d
[root@oracle-linux-7 rules.d]# mv 99-oracleasm.rules ~
[root@oracle-linux-7 rules.d]# /sbin/udevadm control –reload-rules
[root@oracle-linux-7 rules.d]# /sbin/udevadm trigger
The devices in /dev/oracleasm should now be gone, along with the directory.
Now GRID can be started, and I’ll check the status of the diskgroups:
SQL> select name, state from v$asm_diskgroup;
NAME STATE
—————————— ———–
DATA MOUNTED
FRA MOUNTED
SQL> select path from v$asm_disk;
PATH
——————————————————————————–
AFD:DATA1
AFD:FRA1
If your disks don’t show up and the diskgroups don’t mount, make sure your search string has the AFD:* format in it:
SQL> show parameter string
NAME TYPE VALUE
———————- ———– ————————-
asm_diskstring. string. /dev/oracleasm/*, AFD:*
These steps are what led to a successful conversion from UDEV managed devices to ASM Filter Driver managed devices.
If you’re going through or considering a migration and have questions, feel free to reach out to one of our expert DBAs.
{{cta(’40fe6144-2182-4ff8-9625-5b6b14e7cb81′,’justifycenter’)}}