Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

This article will show to use UDEV instead of ASMLib on Oracle Linux 7.

If for any reason you cannot or don't want to use ASMLib, then you can use UDEV instead. This is an alternative in order to present disks to ASM and this does not required to install an extra layer.

In this article, you'll need ...
... Oracle Linux 7 installed (see oel7 installation here)
... root access is needed

Good to know ...
Oracle recommends to use ASMlib for 11g (see install here) or ASMFD for 12g (see grid 12c install here).
ASM features are licence free except snapshot feature (see licensing information here)

Create disk partitions

This is not mandatory but it is recommended to create at least one partition.

#Create disk partition
[root]$ for disk in sdc sdd sde sdh sdi sdj; do
fdisk /dev/$disk <<_EOF_
n
p



w
_EOF_
done

Identify disks

SCSI_ID will be used to identify each disks consistently. On OEL7, SCSI_ID command can be found in /usr/lib/udev/scsi_id.

Two cmd, try the one which works for you  ...
... /usr/lib/udev/scsi_id -g -u -d /dev/sdX
... /usr/lib/udev/scsi_id --page=0x80 --whitelisted --replace-whitespace --device=/dev/sdX

As root, extract id of each disk you will use with asm:

[root]$ /usr/lib/udev/scsi_id -g -u -d /dev/sdc1
    SATA_VBOX_HARDDISK_VB9664741b-88c93566
[root]$ /usr/lib/udev/scsi_id -g -u -d /dev/sdd1
    SATA_VBOX_HARDDISK_VBa95baaba-7f6a13a3
[root]$ /usr/lib/udev/scsi_id -g -u -d /dev/sde1
    SATA_VBOX_HARDDISK_VB32f0066f-086c537d
[root]$ /usr/lib/udev/scsi_id -g -u -d /dev/sdh1
    SATA_VBOX_HARDDISK_VBbc5be7f4-4db0ad83
[root]$ /usr/lib/udev/scsi_id -g -u -d /dev/sdi1
    SATA_VBOX_HARDDISK_VBa7d8987e-e0655c1a
[root]$ /usr/lib/udev/scsi_id -g -u -d /dev/sdj1
    SATA_VBOX_HARDDISK_VB0146a8e5-af298e57

Create UDEV rules

Create or edit /etc/udev/rules.d/99-asm.rules file to add the following rules with the previously extracted id:

KERNEL=="sd?1", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/%k", \
RESULT=="SATA_VBOX_HARDDISK_VB9664741b-88c93566", \
SYMLINK+="oracleasm/disks/ORADATVOL1", OWNER="grid", GROUP="oinstall", MODE="0660"
KERNEL=="sd?1", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/%k", \
RESULT=="SATA_VBOX_HARDDISK_VBa95baaba-7f6a13a3", \
SYMLINK+="oracleasm/disks/ORADATVOL2", OWNER="grid", GROUP="oinstall", MODE="0660"
KERNEL=="sd?1", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/%k", \
RESULT=="SATA_VBOX_HARDDISK_VB32f0066f-086c537d", \
SYMLINK+="oracleasm/disks/ORADATVOL3", OWNER="grid", GROUP="oinstall", MODE="0660"
KERNEL=="sd?1", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/%k", \
RESULT=="SATA_VBOX_HARDDISK_VBbc5be7f4-4db0ad83", \
SYMLINK+="oracleasm/disks/ORAFRAVOL1", OWNER="grid", GROUP="oinstall", MODE="0660"
KERNEL=="sd?1", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/%k", \
RESULT=="SATA_VBOX_HARDDISK_VBa7d8987e-e0655c1a", \
SYMLINK+="oracleasm/disks/ORAFRAVOL2", OWNER="grid", GROUP="oinstall", MODE="0660"
KERNEL=="sd?1", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/%k", \
RESULT=="SATA_VBOX_HARDDISK_VB0146a8e5-af298e57", \
SYMLINK+="oracleasm/disks/ORAFRAVOL3", OWNER="grid", GROUP="oinstall", MODE="0660"

After a reboot, symbolic links should appear as follow:

# List ASM-UDEV disk
[root]$ ls -l /dev/oracleasm/disks/
    total 0
    lrwxrwxrwx 1 root root 10 Jun  9 00:41 ORADATVOL1 -> ../../sdc1
    lrwxrwxrwx 1 root root 10 Jun  9 00:41 ORADATVOL2 -> ../../sdd1
    lrwxrwxrwx 1 root root 10 Jun  9 00:41 ORADATVOL3 -> ../../sde1
    lrwxrwxrwx 1 root root 10 Jun  9 00:41 ORAFRAVOL1 -> ../../sdh1
    lrwxrwxrwx 1 root root 10 Jun  9 00:41 ORAFRAVOL2 -> ../../sdi1
    lrwxrwxrwx 1 root root 10 Jun  9 00:41 ORAFRAVOL3 -> ../../sdj1

Theses disks should be now visible by oracle installation when changing the "disk discovery path" to /dev/oracleasm/disks/*.

udevadm method

If you have udevadm available, it is also a great tool to extract disk info:

# Get disk info with udevadm 
[root]$ udevadm info /dev/sda
    P: /devices/pci0000:00/0000:00:05.0/virtio1/host2/target2:0:0/2:0:0:0/block/sda
    N: sda
    S: disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0
    S: disk/by-path/virtio-pci-0000:00:05.0-scsi-0:0:0:0
    E: DEVLINKS=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0 /dev/disk/by-path/virtio-pci-0000:00:05.0-scsi-0:0:0:0
    E: DEVNAME=/dev/sda
    E: DEVPATH=/devices/pci0000:00/0000:00:05.0/virtio1/host2/target2:0:0/2:0:0:0/block/sda
    E: DEVTYPE=disk
    E: ID_BUS=scsi
    E: ID_FS_TYPE=oracleasm
    E: ID_FS_USAGE=filesystem
    E: ID_MODEL=QEMU_HARDDISK
    E: ID_MODEL_ENC=QEMU\x20HARDDISK\x20\x20\x20
    E: ID_PATH=virtio-pci-0000:00:05.0-scsi-0:0:0:0
    E: ID_PATH_TAG=virtio-pci-0000_00_05_0-scsi-0_0_0_0
    E: ID_REVISION=2.5+
    E: ID_SCSI=1
    E: ID_SERIAL=0QEMU_QEMU_HARDDISK_drive-scsi0
    E: ID_SERIAL_SHORT=drive-scsi0
    E: ID_TYPE=disk
    E: ID_VENDOR=QEMU
    E: ID_VENDOR_ENC=QEMU\x20\x20\x20\x20
    E: MAJOR=8
    E: MINOR=0
    E: MPATH_SBIN_PATH=/sbin
    E: SUBSYSTEM=block
    E: TAGS=:systemd:
    E: USEC_INITIALIZED=92190

Theses inforamtions just extracted can be used as variable in udev rules, like this example rule below:

KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="oracleasm", OWNER="grid", GROUP="asmadmin", MODE="0660"

Then you can reload rules with the following command:

udevadm control --reload-rules && udevadm trigger

HTH,
Michel.

Reference
UDEV SCSI Rules Configuration for ASM (oracle-base)
Creating ASM disks using udev in RHEL 6.2 (spotdba)

Enjoyed this article? Please like it or share it.

Add comment

Please connect with one of social login below (or fill up name and email)

     


Security code
Refresh