Home
 | 
Linux
 | 
Archives
 | 
Template
 | 
UDEV SCSI Rules Configuration for ASM (Oracle Linux 7)
 
Last modified: March 2017
Recent Article
All Archives
Topics
Comments 
by ShanNura
»»
In order for ASM to use disks, it needs to be able to identify the devices consistently and to have the correct ownership and permissions. In Linux we can use ASMLib, but is seen as an additional layer of complexity. Another alternative is Linux's native device manager 'udev' to perform these tasks. I will demonstrate it here in this article.
On the host server (Windows) where I'm running my VM (VirtualBox), I have created 3 sharable virtual disks (/dev/sdb, /dev/sdc, /dev/sdd)and have created partitions after booting the guest machine. If you don't know how to create sharable virtual disks in VirtualBox, check this link (Sharable Virtual Disks).
The available disks can be seen under /dev.
$
[root@olinux dev]# ls -l sd*
brw-rw----. 1 root disk 8,  0 Mar  1 10:31 sda
brw-rw----. 1 root disk 8,  1 Mar  1 10:31 sda1
brw-rw----. 1 root disk 8,  2 Mar  1 10:31 sda2
brw-rw----. 1 root disk 8, 16 Mar  1 10:39 sdb
brw-rw----. 1 root disk 8, 32 Mar  1 10:39 sdc
brw-rw----. 1 root disk 8, 48 Mar  1 10:39 sdd
Use the 'fdisk' command to partition the disks sdb to sdd.
$
[root@olinux dev]# fdisk /dev/sdb
[root@olinux dev]# fdisk /dev/sdc
[root@olinux dev]# fdisk /dev/sdd
Once all the disks are partitioned, the results can be seen by repeating the previous 'ls' command.
$
[root@olinux dev]# ls -l sd*
brw-rw----. 1 root disk 8,  0 Mar  1 10:31 sda
brw-rw----. 1 root disk 8,  1 Mar  1 10:31 sda1
brw-rw----. 1 root disk 8,  2 Mar  1 10:31 sda2
brw-rw----. 1 root disk 8, 16 Mar  1 10:39 sdb
brw-rw----. 1 root disk 8, 17 Mar  1 10:39 sdb1
brw-rw----. 1 root disk 8, 32 Mar  1 10:39 sdc
brw-rw----. 1 root disk 8, 33 Mar  1 10:39 sdc1
brw-rw----. 1 root disk 8, 48 Mar  1 10:39 sdd
brw-rw----. 1 root disk 8, 49 Mar  1 10:39 sdd1
Identify the Disks (/usr/lib/udev/scsi_id)
We are going to write device-specific rules, so we need to be able to identify each device consistently, irrespective of the order in which Linux discovers it. To do this we are going to use the SCSI ID for each disk (not the partition).
$
[root@olinux dev]# /usr/lib/udev/scsi_id -g -u -d /dev/sdb
1ATA_VBOX_HARDDISK_VBd3eb7da9-cf2fb302
[root@olinux dev]# /usr/lib/udev/scsi_id -g -u -d /dev/sdc
1ATA_VBOX_HARDDISK_VBf31f559d-76c321c2
[root@olinux dev]# /usr/lib/udev/scsi_id -g -u -d /dev/sdd
1ATA_VBOX_HARDDISK_VB09f440ca-3daab8c0
Make SCSI Devices Trusted
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.
$
[root@olinux dev]# cat /etc/scsi_id.config
options=-g
Create UDEV Rules
Create an empty file called '/etc/udev/rules.d/99-oracle-asmdevices.rules' and paste the contents as shown here.
$<>  
[root@olinux dev]# cat /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VBd3eb7da9-cf2fb302", SYMLINK+="oracleasm/asm-disk1", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VBf31f559d-76c321c2", SYMLINK+="oracleasm/asm-disk2", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VB09f440ca-3daab8c0", SYMLINK+="oracleasm/asm-disk3", OWNER="grid", GROUP="asmadmin", MODE="0660"
Load Updated Block Device Partitions (/sbin/partprobe)
$
[root@olinux dev]# /sbin/partprobe /dev/sdb1
[root@olinux dev]# /sbin/partprobe /dev/sdc1
[root@olinux dev]# /sbin/partprobe /dev/sdd1
Test Rules (udevtest)
$
[root@olinux dev]# udevadm test /block/sdb/sdb1
[root@olinux dev]# udevadm test /block/sdc/sdc1
[root@olinux dev]# udevadm test /block/sdd/sdd1
The output from the first disk should look something like this...
$<>  
[root@olinux ~]# udevadm test /block/sdb/sdb1
calling: test
version 219
This program is for debugging only, it does not run any program
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

=== trie on-disk ===
tool version:          219
file size:         7014922 bytes
header size             80 bytes
strings            1806418 bytes
nodes              5208424 bytes
Load module index
Created link configuration context.
timestamp of '/etc/udev/rules.d' changed
Reading rules file: /usr/lib/udev/rules.d/10-dm.rules
Reading rules file: /usr/lib/udev/rules.d/100-balloon.rules
Reading rules file: /usr/lib/udev/rules.d/11-dm-lvm.rules
Reading rules file: /usr/lib/udev/rules.d/11-dm-mpath.rules
Reading rules file: /usr/lib/udev/rules.d/13-dm-disk.rules
Reading rules file: /usr/lib/udev/rules.d/40-libgphoto2.rules
IMPORT found builtin 'usb_id --export %%p', replacing /usr/lib/udev/rules.d/40-libgphoto2.rules:11
Reading rules file: /usr/lib/udev/rules.d/40-redhat.rules
Reading rules file: /usr/lib/udev/rules.d/40-usb_modeswitch.rules
Reading rules file: /usr/lib/udev/rules.d/42-usb-hid-pm.rules
Reading rules file: /usr/lib/udev/rules.d/50-rbd.rules
Reading rules file: /usr/lib/udev/rules.d/50-udev-default.rules
Reading rules file: /usr/lib/udev/rules.d/56-hpmud.rules
Reading rules file: /usr/lib/udev/rules.d/60-alias-kmsg.rules
Reading rules file: /usr/lib/udev/rules.d/60-cdrom_id.rules
Reading rules file: /usr/lib/udev/rules.d/60-drm.rules
Reading rules file: /usr/lib/udev/rules.d/60-fprint-autosuspend.rules
Reading rules file: /usr/lib/udev/rules.d/60-keyboard.rules
Reading rules file: /usr/lib/udev/rules.d/60-net.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-alsa.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-input.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-serial.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-storage-tape.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-storage.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-v4l.rules
Reading rules file: /usr/lib/udev/rules.d/60-raw.rules
Reading rules file: /usr/lib/udev/rules.d/61-accelerometer.rules
Reading rules file: /usr/lib/udev/rules.d/61-gnome-bluetooth-rfkill.rules
Reading rules file: /usr/lib/udev/rules.d/61-gnome-settings-daemon-rfkill.rules
Reading rules file: /usr/lib/udev/rules.d/62-multipath.rules
Reading rules file: /usr/lib/udev/rules.d/63-md-raid-arrays.rules
Reading rules file: /usr/lib/udev/rules.d/64-btrfs.rules
Reading rules file: /usr/lib/udev/rules.d/65-libwacom.rules
Reading rules file: /usr/lib/udev/rules.d/65-md-incremental.rules
Reading rules file: /usr/lib/udev/rules.d/65-sane-backends.rules
Reading rules file: /usr/lib/udev/rules.d/69-cd-sensors.rules
Reading rules file: /usr/lib/udev/rules.d/69-dm-lvm-metad.rules
Reading rules file: /usr/lib/udev/rules.d/69-libmtp.rules
Reading rules file: /usr/lib/udev/rules.d/69-xorg-vmmouse.rules
Reading rules file: /usr/lib/udev/rules.d/70-mouse.rules
Reading rules file: /etc/udev/rules.d/70-persistent-ipoib.rules
Reading rules file: /usr/lib/udev/rules.d/70-power-switch.rules
Reading rules file: /usr/lib/udev/rules.d/70-printers.rules
Reading rules file: /usr/lib/udev/rules.d/70-spice-vdagentd.rules
Reading rules file: /usr/lib/udev/rules.d/70-touchpad-quirks.rules
Reading rules file: /usr/lib/udev/rules.d/70-touchpad.rules
Reading rules file: /usr/lib/udev/rules.d/70-uaccess.rules
Reading rules file: /usr/lib/udev/rules.d/70-wacom.rules
Reading rules file: /usr/lib/udev/rules.d/71-biosdevname.rules
Reading rules file: /usr/lib/udev/rules.d/71-seat.rules
Reading rules file: /usr/lib/udev/rules.d/73-idrac.rules
Reading rules file: /usr/lib/udev/rules.d/73-seat-late.rules
Reading rules file: /usr/lib/udev/rules.d/75-net-description.rules
Reading rules file: /usr/lib/udev/rules.d/75-probe_mtd.rules
Reading rules file: /usr/lib/udev/rules.d/75-tty-description.rules
Reading rules file: /usr/lib/udev/rules.d/77-mm-ericsson-mbm.rules
Reading rules file: /usr/lib/udev/rules.d/77-mm-huawei-net-port-types.rules
Reading rules file: /usr/lib/udev/rules.d/77-mm-longcheer-port-types.rules
Reading rules file: /usr/lib/udev/rules.d/77-mm-nokia-port-types.rules
Reading rules file: /usr/lib/udev/rules.d/77-mm-pcmcia-device-blacklist.rules
Reading rules file: /usr/lib/udev/rules.d/77-mm-platform-serial-whitelist.rules
Reading rules file: /usr/lib/udev/rules.d/77-mm-simtech-port-types.rules
Reading rules file: /usr/lib/udev/rules.d/77-mm-telit-port-types.rules
Reading rules file: /usr/lib/udev/rules.d/77-mm-usb-device-blacklist.rules
Reading rules file: /usr/lib/udev/rules.d/77-mm-usb-serial-adapters-greylist.rules
Reading rules file: /usr/lib/udev/rules.d/77-mm-x22x-port-types.rules
Reading rules file: /usr/lib/udev/rules.d/77-mm-zte-port-types.rules
Reading rules file: /usr/lib/udev/rules.d/78-sound-card.rules
Reading rules file: /usr/lib/udev/rules.d/80-drivers.rules
Reading rules file: /usr/lib/udev/rules.d/80-kvm.rules
Reading rules file: /usr/lib/udev/rules.d/80-mm-candidate.rules
Reading rules file: /usr/lib/udev/rules.d/80-net-name-slot.rules
Reading rules file: /usr/lib/udev/rules.d/80-net-setup-link.rules
Reading rules file: /usr/lib/udev/rules.d/80-udisks2.rules
Reading rules file: /usr/lib/udev/rules.d/81-kvm-rhel.rules
Reading rules file: /usr/lib/udev/rules.d/85-nm-unmanaged.rules
Reading rules file: /usr/lib/udev/rules.d/85-regulatory.rules
Reading rules file: /usr/lib/udev/rules.d/85-usbmuxd.rules
Reading rules file: /usr/lib/udev/rules.d/90-alsa-restore.rules
Reading rules file: /usr/lib/udev/rules.d/90-alsa-tools-firmware.rules
Reading rules file: /usr/lib/udev/rules.d/90-iprutils.rules
Reading rules file: /usr/lib/udev/rules.d/90-pulseaudio.rules
Reading rules file: /usr/lib/udev/rules.d/90-vconsole.rules
Reading rules file: /usr/lib/udev/rules.d/91-drm-modeset.rules
Reading rules file: /usr/lib/udev/rules.d/95-cd-devices.rules
Reading rules file: /usr/lib/udev/rules.d/95-dm-notify.rules
Reading rules file: /usr/lib/udev/rules.d/95-udev-late.rules
Reading rules file: /usr/lib/udev/rules.d/95-upower-csr.rules
Reading rules file: /usr/lib/udev/rules.d/95-upower-hid.rules
Reading rules file: /usr/lib/udev/rules.d/95-upower-wup.rules
Reading rules file: /usr/lib/udev/rules.d/98-kexec.rules
Reading rules file: /usr/lib/udev/rules.d/98-rdma.rules
Reading rules file: /etc/udev/rules.d/99-oracle-asmdevices.rules
Reading rules file: /usr/lib/udev/rules.d/99-qemu-guest-agent.rules
Reading rules file: /usr/lib/udev/rules.d/99-systemd.rules
Reading rules file: /etc/udev/rules.d/99-vmware-scsi-timeout.rules
invalid key/value pair in file /etc/udev/rules.d/99-vmware-scsi-timeout.rules on line 1, starting at character 60 (',')
invalid key/value pair in file /etc/udev/rules.d/99-vmware-scsi-timeout.rules on line 2, starting at character 30 (',')
invalid key/value pair in file /etc/udev/rules.d/99-vmware-scsi-timeout.rules on line 3, starting at character 1 ('>')
rules contain 393216 bytes tokens (32768 * 12 bytes), 32072 bytes strings
29790 strings (247369 bytes), 26857 de-duplicated (218231 bytes), 2934 trie nodes used
GROUP 6 /usr/lib/udev/rules.d/50-udev-default.rules:52
LINK 'disk/by-id/ata-VBOX_HARDDISK_VBd3eb7da9-cf2fb302-part1' /usr/lib/udev/rules.d/60-persistent-storage.rules:43
IMPORT builtin 'blkid' /usr/lib/udev/rules.d/60-persistent-storage.rules:72
probe /dev/sdb1 raid offset=0
PROGRAM '/usr/lib/udev/scsi_id -g -u -d /dev/sdb' /etc/udev/rules.d/99-oracle-asmdevices.rules:1
starting '/usr/lib/udev/scsi_id -g -u -d /dev/sdb'
'/usr/lib/udev/scsi_id -g -u -d /dev/sdb'(out) '1ATA_VBOX_HARDDISK_VBd3eb7da9-cf2fb302'
'/usr/lib/udev/scsi_id -g -u -d /dev/sdb' [1826] exit with return code 0
OWNER 54322 /etc/udev/rules.d/99-oracle-asmdevices.rules:1
GROUP 54329 /etc/udev/rules.d/99-oracle-asmdevices.rules:1
MODE 0660 /etc/udev/rules.d/99-oracle-asmdevices.rules:1
LINK 'oracleasm/asm-disk1' /etc/udev/rules.d/99-oracle-asmdevices.rules:1
PROGRAM '/usr/lib/udev/scsi_id -g -u -d /dev/sdb' /etc/udev/rules.d/99-oracle-asmdevices.rules:2
starting '/usr/lib/udev/scsi_id -g -u -d /dev/sdb'
'/usr/lib/udev/scsi_id -g -u -d /dev/sdb'(out) '1ATA_VBOX_HARDDISK_VBd3eb7da9-cf2fb302'
'/usr/lib/udev/scsi_id -g -u -d /dev/sdb' [1827] exit with return code 0
PROGRAM '/usr/lib/udev/scsi_id -g -u -d /dev/sdb' /etc/udev/rules.d/99-oracle-asmdevices.rules:3
starting '/usr/lib/udev/scsi_id -g -u -d /dev/sdb'
'/usr/lib/udev/scsi_id -g -u -d /dev/sdb'(out) '1ATA_VBOX_HARDDISK_VBd3eb7da9-cf2fb302'
'/usr/lib/udev/scsi_id -g -u -d /dev/sdb' [1828] exit with return code 0
handling device node '/dev/sdb1', devnum=b8:17, mode=0660, uid=54322, gid=54329
preserve permissions /dev/sdb1, 060660, uid=54322, gid=54329
preserve already existing symlink '/dev/block/8:17' to '../sdb1'
found 'b8:17' claiming '/run/udev/links/\x2fdisk\x2fby-id\x2fata-VBOX_HARDDISK_VBd3eb7da9-cf2fb302-part1'
creating link '/dev/disk/by-id/ata-VBOX_HARDDISK_VBd3eb7da9-cf2fb302-part1' to '/dev/sdb1'
preserve already existing symlink '/dev/disk/by-id/ata-VBOX_HARDDISK_VBd3eb7da9-cf2fb302-part1' to '../../sdb1'
found 'b8:17' claiming '/run/udev/links/\x2foracleasm\x2fasm-disk1'
creating link '/dev/oracleasm/asm-disk1' to '/dev/sdb1'
preserve already existing symlink '/dev/oracleasm/asm-disk1' to '../sdb1'
created db file '/run/udev/data/b8:17' for '/block/sdb/sdb1'
.ID_FS_TYPE_NEW=oracleasm
ACTION=add
DEVLINKS=/dev/disk/by-id/ata-VBOX_HARDDISK_VBd3eb7da9-cf2fb302-part1 /dev/oracleasm/asm-disk1
DEVNAME=/dev/sdb1
DEVPATH=/block/sdb/sdb1
DEVTYPE=partition
ID_ATA=1
ID_ATA_FEATURE_SET_PM=1
ID_ATA_FEATURE_SET_PM_ENABLED=1
ID_ATA_SATA=1
ID_ATA_SATA_SIGNAL_RATE_GEN2=1
ID_ATA_WRITE_CACHE=1
ID_ATA_WRITE_CACHE_ENABLED=1
ID_BUS=ata
ID_FS_TYPE=oracleasm
ID_FS_USAGE=filesystem
ID_MODEL=VBOX_HARDDISK
ID_MODEL_ENC=VBOX\x20HARDDISK\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
ID_PART_ENTRY_DISK=8:16
ID_PART_ENTRY_NUMBER=1
ID_PART_ENTRY_OFFSET=2048
ID_PART_ENTRY_SCHEME=dos
ID_PART_ENTRY_SIZE=25163776
ID_PART_ENTRY_TYPE=0x83
ID_PART_TABLE_TYPE=dos
ID_REVISION=1.0
ID_SERIAL=VBOX_HARDDISK_VBd3eb7da9-cf2fb302
ID_SERIAL_SHORT=VBd3eb7da9-cf2fb302
ID_TYPE=disk
MAJOR=8
MINOR=17
SUBSYSTEM=block
TAGS=:systemd:
USEC_INITIALIZED=11311
Unload module index
Unloaded link configuration context.
Restart UDEV Service
$
[root@olinux dev]# /sbin/udevadm control --reload-rules
Check Ownership and Permissions
The disks should now be visible and have the correct ownership using the following command. If they are not visible, your UDEV configuration is incorrect and must be fixed before you proceed.
$
[root@olinux dev]# ls -al /dev/oracleasm/*
lrwxrwxrwx. 1 root root 7 Mar  1 10:58 /dev/oracleasm/asm-disk1 -> ../sdb1
lrwxrwxrwx. 1 root root 7 Mar  1 10:58 /dev/oracleasm/asm-disk2 -> ../sdc1
lrwxrwxrwx. 1 root root 7 Mar  1 10:58 /dev/oracleasm/asm-disk3 -> ../sdd1
The symbolic links are owned by root, but the devices they point to now have the correct ownership.
$
[root@olinux dev]# ls -al /dev/sd*1
brw-rw----. 1 root disk     8,  1 Mar  1 10:31 /dev/sda1
brw-rw----. 1 grid asmadmin 8, 17 Mar  1 10:58 /dev/sdb1
brw-rw----. 1 grid asmadmin 8, 33 Mar  1 10:58 /dev/sdc1
brw-rw----. 1 grid asmadmin 8, 49 Mar  1 10:58 /dev/sdd1
The ASM disks are now configured to continue with GI installation.
Please write your comment if this article was useful.

Shannura

/
You might want to read this: