How to install ASMLIB on CentOS 7

Share on Social Media

In this tutorial, you will learn, how to install ASMLIB on CentOS 7 or other Red hat based Linux servers. #centlinux #linux #oracle

ASMLIB is an optional support library for the ASM (Automatic Storage Management) feature of the Oracle Database. ASM simplifies storage administration and greatly reduces kernel resource usage (e.g. the number of open file descriptors). It eliminates the need for the DBA (Database Administrator) to directly manage potentially thousands of Oracle database files, requiring only the management of groups of disks allocated to the Oracle Database. ASMLIB allows an Oracle Database using ASM more efficient and capable access to the disk groups it is using.

In previous releases, Oracle ASM was installed as part of the Oracle Database installation. With Oracle Database 11g Release 2 (11.2), Oracle ASM is part of an Oracle Grid Infrastructure installation, either for a cluster, or for a standalone server.

In this article, we will install ASMLIB on CentOS 7 based Linux Server, and mark the disks for use by the Oracle Grid Infrastructure or more specifically Oracle ASM component of the Oracle Grid Infrastructure.

System Specification:

We have a Linux virtual machine with following specification.

CPU2.4 Ghz (Single Core)
Memory2 GB
Storage45 GB (20 GB for Swap and Linux, 25GB for ASM Disks)

Create disk partitions in Linux:

Check the available free space using fdisk.

# fdisk –l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00035159

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        2611    20458496   8e  Linux LVM

Disk /dev/sdb: 26.8 GB, 26843545600 bytes
255 heads, 63 sectors/track, 3263 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg_gridserver-lv_root: 18.9 GB, 18865979392 bytes
255 heads, 63 sectors/track, 2293 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg_gridserver-lv_swap: 2080 MB, 2080374784 bytes
255 heads, 63 sectors/track, 252 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

From the above output, we have /dev/sdb is available with 26 GB storage. Now, we will create 6 equal size (i.e. 4GB each) partitions as follows:

# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xf5d5e858.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to
         switch off the mode (command ‘c’) and change display units to
         sectors (command ‘u’).

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
e
Partition number (1-4): 1
First cylinder (1-3263, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-3263, default 3263):
Using default value 3263

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (1-3263, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-3263, default 3263): +4G

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (524-3263, default 524):
Using default value 524
Last cylinder, +cylinders or +size{K,M,G} (524-3263, default 3263): +4G

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (1047-3263, default 1047):
Using default value 1047
Last cylinder, +cylinders or +size{K,M,G} (1047-3263, default 3263): +4G

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (1570-3263, default 1570):
Using default value 1570
Last cylinder, +cylinders or +size{K,M,G} (1570-3263, default 3263): +4G

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (2093-3263, default 2093):
Using default value 2093
Last cylinder, +cylinders or +size{K,M,G} (2093-3263, default 3263): +4G

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (2616-3263, default 2616):
Using default value 2616
Last cylinder, +cylinders or +size{K,M,G} (2616-3263, default 3263): +4G

Command (m for help): p

Disk /dev/sdb: 26.8 GB, 26843545600 bytes
255 heads, 63 sectors/track, 3263 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf5d5e858

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        3263    26210016    5  Extended
/dev/sdb5               1         523     4200934+  83  Linux
/dev/sdb6             524        1046     4200966   83  Linux
/dev/sdb7            1047        1569     4200966   83  Linux
/dev/sdb8            1570        2092     4200966   83  Linux
/dev/sdb9            2093        2615     4200966   83  Linux
/dev/sdb10           2616        3138     4200966   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Now, we have 6 partitions (4GB each), that we can use for Oracle ASM Storage Disks.

Install ASMLIB on CentOS 7:

The Oracle ASMLIB kernel driver is now included in the UEK (Unbreakable Enterprise Kernel).  No driver package needs to be installed when using this kernel.  The oracleasm-support and oracleasmlib packages still need to be installed from ULN (Unbreakable Linux Network).

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 or up2date to download and install the package on their servers. Non-subscribers are free to use the similar package built for RHEL (Red Hat Enterprise Linux) on their Oracle Linux machines.

Good News is that oracleasm kernel driver is also available from the RHEL and CentOS yum repositories. Since, our OS is CentOS 6.3, therefore, I can easily install it using yum.

Check if oracleasm module is available for your Linux distro as follows:

# yum search oracleasm
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
* base: centos.mirror.net.in
* extras: centos.mirror.net.in
* updates: centos.mirror.net.in
base                                       | 3.7 kB     00:00
extras                                     | 3.4 kB     00:00
updates                                    | 3.4 kB     00:00
==================== N/S Matched: oracleasm==========================
kmod-oracleasm.x86_64 : oracleasm kernel module(s)

  Name and summary matches only, use “search all” for everything.

Install ASMLIB on CentOS 7 now.

# yum install oracleasm

Once, Kernel is updated, download and install latest versions of oracleasm-support and oracleasmlib from Oracle website.

# cd
# wget http://oss.oracle.com/projects/oracleasm-support/dist/files/RPMS/rhel6/amd64/2.1.8/oracleasm-support-2.1.8-1.el6.x86_64.rpm
--2016-04-10 06:04:52--  https://oss.oracle.com/projects/oracleasm-support/dist/files/RPMS/rhel6/amd64/2.1.8/oracleasm-support-2.1.8-1.el6.x86_64.rpm
Connecting to oss.oracle.com|137.254.120.35|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 74984 (73K) [application/x-rpm]
Saving to: âoracleasm-support-2.1.8-1.el6.x86_64.rpmâ

100%[==============================>] 74,984      52.4K/s   in 1.4s

2016-04-10 06:04:54 (52.4 KB/s) – âoracleasm-support-2.1.8-1.el6.x86_64.rpmâ

# wget http://download.oracle.com/otn_software/asmlib/oracleasmlib-2.0.4-1.el6.x86_64.rpm
–2016-04-10 06:05:08–  http://download.oracle.com/otn_software/asmlib/oracleasmlib-2.0.4-1.el6.x86_64.rpm
Resolving download.oracle.com… 110.93.233.18, 110.93.233.32
Connecting to download.oracle.com|110.93.233.18|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 13300 (13K) [application/x-redhat-package-manager]
Saving to: âoracleasmlib-2.0.4-1.el6.x86_64.rpmâ

100%[=============================>] 13,300      –.-K/s   in 0.01s

2016-04-10 06:05:08 (913 KB/s) – âoracleasmlib-2.0.4-1.el6.x86_64.rpmâ

# ls
anaconda-ks.cfg  install.log  install.log.syslog  oracleasmlib-2.0.4-1.el6.x86_64.rpm  oracleasm-support-2.1.8-1.el6.x86_64.rpm
# rpm -ivh oracleasm-support-2.1.8-1.el6.x86_64.rpm
warning: oracleasm-support-2.1.8-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:oracleasm-support      ########################################### [100%]
# rpm -ivh oracleasmlib-2.0.4-1.el6.x86_64.rpm
warning: oracleasmlib-2.0.4-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:oracleasmlib           ########################################### [100%]

We have successfully install ASMLIB on CentOS 7.

Create Users and Roles:

Create following OS users and groups as required by Oracle Grid Infrastructure 12c.

# groupadd -g 601 oinstall
# groupadd -g 602 dba
# groupadd -g 603 oper
# groupadd -g 604 asmadmin
# groupadd -g 605 asmoper
# groupadd -g 606 asmdba
# useradd -u 601 -g oinstall -G asmadmin,asmdba,asmoper grid
# passwd grid
Changing password for user grid.
New password:
BAD PASSWORD: it is WAY too short
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.

Configure Oracle ASM Library Driver:

Configure Oracle ASM Library Driver as follows:

# oracleasm configure -i
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver.  The following questions will determine whether the driver is
loaded on boot and what permissions it will have.  The current values
will be shown in brackets (‘[]’).  Hitting <ENTER> without typing an
answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface []: grid
Default group to own the driver interface []: asmadmin
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done

Beware that, if you omit the user and group in the above configuration then it will be set to default user root and default group root, and it creates problem while detecting candidate disks during grid infrastructure installation.

# oracleasm init
Creating /dev/oracleasm mount point: /dev/oracleasm
Loading module "oracleasm": oracleasm
Configuring "oracleasm" to use device physical block size
Mounting ASMlib driver filesystem: /dev/oracleasm

Create ASM Disks:

ASMLIB does not support SELINUX, therefore we must disable the SELINUX before move on.

# setenforce 0
# sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config && cat /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing – SELinux security policy is enforced.
#     permissive – SELinux prints warnings instead of enforcing.
#     disabled – No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted – Targeted processes are protected,
#     mls – Multi Level Security protection.
SELINUXTYPE=targeted

Create ASM disks, I will create 3 disks for oradata and 3 disks for recovery_area.

# oracleasm createdisk ASM_DATA1 /dev/sdb5
Writing disk header: done
Instantiating disk: done
# oracleasm createdisk ASM_DATA2 /dev/sdb6
Writing disk header: done
Instantiating disk: done
# oracleasm createdisk ASM_DATA3 /dev/sdb7
Writing disk header: done
Instantiating disk: done
# oracleasm createdisk ASM_FRA1 /dev/sdb8
Writing disk header: done
Instantiating disk: done
# oracleasm createdisk ASM_FRA2 /dev/sdb9
Writing disk header: done
Instantiating disk: done
# oracleasm createdisk ASM_FRA3 /dev/sdb10
Writing disk header: done
Instantiating disk: done

If you are installing Oracle Grid Infrastructure for a cluster and the disks are located at a shared storage that are already marked by another node in RAC then these disks can only be scanned by following command after setup iScsi Initiator.

oracleasm scandisks

ASMLIB has been installed and ASM disks have been created. We can install Oracle Grid Infrastructure 12c on the Server.

Read Also: Install Oracle Grid Infrastructure 12c as Stand Alone Server

Conclusion – Install ASMLIB on CentOS 7:

In this tutorial, you have learned, how to install ASMLIB on CentOS 7 or other Red hat based Linux servers. #centlinux #linux #oracle

Scroll to Top