Oracleasmlib Not Necessary

by Seth Miller

Not only is it not necessary, but it may not even be available. This is in fact exactly what I discovered recently when I installed the Oracle Linux 6u3 and tried to install Clusterware on it.

There are three packages that one would normally install as part of ASM:

  • oracleasm-$( uname -r ) # Kernel driver
  • oracleasmlib # ASM libraries
  • oracleasm-support # Support scripts

In Oracle Linux 6, the driver is built into the kernel so it is no longer necessary to install the first item in the list. The OTN site for ASM claims that the

“oracleasm-support and oracleasmlib packages still need to be installed from ULN.”

However, say you are like me and too lazy to try to get the necessary credentials out of the Unix team for access to ULN and you therefore use the publically available yum repository. The Oracle Linux 5 “Latest” repo has the oracleasm-support packages and the oracleasm kernel drivers for each kernel released for that version. In the Oracle Linux 6 “Latest” repo, only the oracleasm-support packages are there. The oracleasmlib packages are not in any of the public yum repositories. The oracleasmlib package is available for all versions in ULN though as well as a manual download as this OTN note clarifies.

“While the driver and support tools are on the Oracle Linux installation media, the oracleasmlib RPM is not (this package allows Oracle to access the kernel driver). This package is only available on ULN. Subscribers to ULN can use yum(8) or up2date(8) to download and install the package on their servers. Non-subscribers are free to use the similar package built for RHEL on their Oracle Linux machines. New ULN subscribers that happen to be using the RHEL version of the oracleasmlib package are advised to update the package from ULN.”

In other words, if you want oracleasmlib and you don’t have access to ULN, you can download the RPM manually from here. Make sure to download the one that matches your architecture (x86 or x86_64).

Once you have an ASM disk created through oracleasm, there are two ways to test it to make sure it works. One is to use a program that is included in the oracleasmlib package called oracleasm-discover. Running oracleasm-discovery will show a simple text output similar to the following.

[root@generic ~]# oracleasm-discover
Using ASMLib from /opt/oracle/extapi/32/asm/orcl/1/
[ASM Library - Generic Linux, version 2.0.4 (KABI_V2)]
Discovered disk: ORCL:DATA1 [192717 blocks (98671104 bytes), maxio 512]
Discovered disk: ORCL:DATA2 [1012032 blocks (518160384 bytes), maxio 512]

You’ll notice that this is using the 32 bit library. The OS that I tested this on is 64 bit and I spent a lot of time wondering why I could see the disks with oracleasm-discover but not with asmca until I came across MOS article 1444115.1. Under Case #1, there is a note about using the wrong library. I uninstalled the 32 bit version and installed the 64 bit version. oracleasm-discover still works but this time I was also able to see the disks in asmca.

[root@generic ~]# rpm -ev oracleasmlib

[root@generic ~]# rpm -ivh
warning: /var/tmp/rpm-tmp.ZhUEGs: Header V3 DSA/SHA1 Signature, key ID 1e5e0159: NOKEY
Preparing... ########################################### [100%]
1:oracleasmlib ########################################### [100%]

[root@generic ~]# oracleasm-discover
Using ASMLib from /opt/oracle/extapi/64/asm/orcl/1/
[ASM Library - Generic Linux, version 2.0.4 (KABI_V2)]
Discovered disk: ORCL:DATA1 [192717 blocks (98671104 bytes), maxio 512]
Discovered disk: ORCL:DATA2 [1012032 blocks (518160384 bytes), maxio 512]

Now back to the title of this post. Oracleasmlib is not necessary to have in order to use ASM. It only offers the management of the disk devices to make them accessible to ASM without a lot of manual intervention. If you would like to understand the philosophical differences between using oracleasmlib or not, there is plenty of debate over at the Oracle Forums.

Very simply, the only thing ASM needs to consider a candidate ASM disk is a block device with the appropriate ownership and permissions. A simple test is to directly change the ownership and permissions of the block devices you have created for ASM and use asmca with a different discovery path that will find them.

[root@generic ~]# service oracleasm stop
Dropping Oracle ASMLib disks: [ OK ]
Shutting down the Oracle ASMLib driver: [ OK ]

[root@generic ~]# rpm -ev oracleasmlib

[root@generic ~]# rpm -ev oracleasm-support
warning: /etc/sysconfig/oracleasm saved as /etc/sysconfig/oracleasm.rpmsave

[root@generic ~]# chown grid.dba /dev/{sdb1,sdc1}

[root@generic ~]# chmod 0660 /dev/{sdb1,sdc1}

[root@generic ~]# ll /dev/{sdb1,sdc1}
brw-rw---- 1 grid dba 8, 17 Nov 2 06:53 /dev/sdb1
brw-rw---- 1 grid dba 8, 33 Nov 2 06:55 /dev/sdc1

That was a lot of work, especially if you are adding more devices and it won’t survive a reboot. Fortunately, there is a supported method to do this with more automation (and more importantly to survive a reboot) using a native Linux tool called “udev”. udev already does what we just did with all of the other devices present in /dev. We just need to tell it what specifically to do by creating a configuration file.

[root@generic ~]# DEVS=(sdb sdc)
NUM=$( sed -r -n -e '$!d' -e 's/.*NAME="asm-disk([^"]+)".*/\1/p' /etc/udev/rules.d/99-oracle-asmdevices.rules 2>/dev/null )
for I in ${DEVS[*]}; do
  echo 'KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="'\
  "$( /sbin/scsi_id -g -u -d /dev/$I )\", NAME=\"asm-disk$NUM"\
  '", OWNER="grid", GROUP="dba", MODE="0660"'\
  >> /etc/udev/rules.d/99-oracle-asmdevices.rules

[root@generic ~]# cat /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VBa70ffc27-81275aac", NAME="asm-disk1", OWNER="grid", GROUP="dba", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VB3a0c6747-92f57443", NAME="asm-disk2", OWNER="grid", GROUP="dba", MODE="0660"

[root@generic ~]# udevadm test /block/sdb/sdb1
udev_rules_apply_to_event: OWNER 54322 /etc/udev/rules.d/99-oracle-asmdevices.rules:2
udev_rules_apply_to_event: GROUP 54322 /etc/udev/rules.d/99-oracle-asmdevices.rules:2
udev_rules_apply_to_event: MODE 0660 /etc/udev/rules.d/99-oracle-asmdevices.rules:2
udev_rules_apply_to_event: NAME 'asm-disk1' /etc/udev/rules.d/99-oracle-asmdevices.rules:2
udev_rules_apply_to_event: PROGRAM '/sbin/scsi_id -g -u -d /dev/sdb' /etc/udev/rules.d/99-oracle-asmdevices.rules:3
util_run_program: '/sbin/scsi_id -g -u -d /dev/sdb' started
util_run_program: '/sbin/scsi_id' (stdout) '1ATA_VBOX_HARDDISK_VBa70ffc27-81275aac'
util_run_program: '/sbin/scsi_id -g -u -d /dev/sdb' returned with exitcode 0
udev_node_add: creating device node '/dev/asm-disk1', devnum=8:17, mode=0660, uid=54322, gid=54322
udev_node_mknod: mknod(/dev/asm-disk1, 060660, (8,17))
udev_node_mknod: set permissions /dev/asm-disk1, 060660, uid=54322, gid=54322
node_symlink: atomically replace '/dev/block/8:17'

[root@generic ~]# udevadm control --reload-rules

[root@generic ~]# udevadm control --start-exec-queue

[root@generic ~]# partprobe /dev/sdb1

[root@generic ~]# partprobe /dev/sdc1

[root@generic ~]# ll /dev/asm*
brw-rw---- 1 grid dba 8, 17 Nov  2 06:33 /dev/asm-disk1
brw-rw---- 1 grid dba 8, 33 Nov  2 06:33 /dev/asm-disk2

Finally, here is a good overview of the current state of Oracle ASMlib from Wim Coekaerts, the Senior Vice President of Linux and Virtualization Engineering at Oracle.

  • Oracle ASM does not in any way require ASMLib to function completely. ASMlib is a small set of extensions, in particular to make device management easier but there are no extra features exposed through Oracle ASM with ASMLib enabled or disabled. Often customers confuse ASMlib with ASM. again, ASM exists on every Oracle supported OS and on every supported Linux OS, SLES, RHEL, OL without ASMLib
  • Oracle ASMLib userspace is available for OTN and the kernel module is shipped along with OL/UEK for every build and by SuSE for SLES for every of their builds
  • ASMLib kernel module was built by us for RHEL4 and RHEL5 but we do not build it for RHEL6, nor for the OL6 RHCK kernel. Only for UEK
  • ASMLib for Linux is/was a reference implementation for any third party vendor to be able to offer, if they want to, their own version for their own OS or storage
  • ASMLib as provided by Oracle for Linux continues to be enhanced and evolve and for the kernel module we use UEK as the base OS kernel