How to setup UDEV for an Oracle ASM standalone install (no asmlib in this post)

I used VirtualBox (Oracle’s Desktop VM) and CentOS 6.8 for this post.
So, yes we could do this ASM install with Oracle’s asmlib rpms… but what if your company won’t allow that?  Then udev will work, and it’s just about as easy – well neither method is really simple – but not too bad.
Installed RHEL / CentOS 6.8 with only one disk created when I first created the VM.  Let the installer use that disk for all it’s install requirements.
Then after I had the initial install of Linux setup on that disk kind of the way I wanted it – then and only then – I added two new SATA disks – FRADisk1 and DataDisk1 via VirtualBox.  I waited for the 2nd two devices so the installer could not even consider setting those two devices up as ext4 based file systems – ASM does not use ext4.
vBoxFRA
Later, after the OS install, I created two more disks with VirtualBox for this VM to be used for ASM – FRADisk1.vdi, DataDisk1.vdi – dynamically allocated 40GB and 80GB respectively – you can make them smaller if you choose – not sure what the minimums are – 20/20GB should be fine.
Now fdisk both devices separately – generally as follows:
# before the fdisk

[root@udevo12c Desktop]# ls /dev/sd*
/dev/sda /dev/sda1 /dev/sda2 /dev/sdb /dev/sdc
fdisk /dev/sdb
fdisk /dev/sdc

# details in this screen shot
 
udev-fdisk

[root@udevo12c Desktop]# ls /dev/sd*
/dev/sda /dev/sda1 /dev/sda2 /dev/sdb /dev/sdb1 /dev/sdc /dev/sdc1

Now lets update the block device partition tables:

/sbin/partprobe /dev/sdb1
/sbin/partprobe /dev/sdc1

Now – the udev stuff… – I’ll caution you – the syntax and path can vary between RHEL 5/6/7 – this post uses RHEL 6 syntax – the concepts are the same.
What is udev… well you can google that but, generally a way to dynamically allocate devices and provide run time control about owner ship etc.
Generally you setup a file(s) in /etc/udev/rules.d – that defines the /dev devices you want to control.

First, add the following to the "/etc/scsi_id.config" file to configure SCSI devices as trusted. Create the file if it doesn't already exist.
options=-g

Lets create the file: /etc/udev/rules.d/99-oracle-asmdevices.rules – this is going to look syntactically complex – but after breaking it down, it’s not as bad as it looks.  There are three parts to each line in this file.  By the way, this is RHEL 6.8 so future versions may have slightly different syntax building the rule.

vi /etc/udev/rules.d/99-oracle-asmdevices.rules

This first part is relatively fixed – the first part of one line – only thing variable in this is “sdb1” that may change…

KERNEL=="sdb1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT==

The next two parts (parts 2 and 3) define – a physical name for the device obtained with the “scsi_id” command, and the logical name, and ownership info.
So lets get the 2nd part:

[root@udevo12c Desktop]# /sbin/scsi_id -g -u -d /dev/sdb
1ATA_VBOX_HARDDISK_VBdc97070c-ca49e940

Now add it to the string in quotes…

KERNEL=="sdb1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VBdc97070c-ca49e940",

Now add the 3rd part… which is just a name, owner, group and protection in this format:  , NAME=”FRADisk1″, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″
Note: all on one line

KERNEL=="sdb1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VBdc97070c-ca49e940", NAME="FRADisk1", OWNER="grid"
, MODE="0660"

Here is the complete file in all it’s glory with no block quotes – note there are two physical lines – the post appears to divide them:
[root@udevo12c Desktop]# cat /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL==”sdb1″, BUS==”scsi”, PROGRAM==”/sbin/scsi_id -g -u -d /dev/$parent”, RESULT==”1ATA_VBOX_HARDDISK_VBdc97070c-ca49e940″, NAME=”FRADisk1″, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″
KERNEL==”sdc1″, BUS==”scsi”, PROGRAM==”/sbin/scsi_id -g -u -d /dev/$parent”, RESULT==”1ATA_VBOX_HARDDISK_VB18e40b71-96055a2a”, NAME=”DataDisk1″, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″
Now test it

udevadm test /block/sdb/sdb1

# using RHEL 7 – the path is different

usr/lib/udev/scsi_id -g -u -d /dev/sdb

If you change something in the rules file like – owner or group and the device is a disk – reboot it will get picked up – that’s the easiest way – there are others.

Leave a Comment

Scroll to Top