Preparing Drives for ASM using ASMLib

This document will detail the steps to configure disks for ASM and the installation of ASMLib on Oracle Enterprise Linux 5.5 running in Oracle VM VirtualBox 4.1.2. The drives were created as shared drives. See the post: Creating Shared Drives in Oracle VM VirtualBox for more information on creating shared drives in Oracle VM VirtualBox.

Verify the drives are on the system.

[root@newhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              35G  8.5G   25G  26% /
tmpfs                 252M     0  252M   0% /dev/shm
[root@newhost ~]# ls -al /dev/sd*
brw-r----- 1 root disk 8,   0 Jul 14 12:22 /dev/sda
brw-r----- 1 root disk 8,   1 Jul 14 12:22 /dev/sda1
brw-r----- 1 root disk 8,   2 Jul 14 12:22 /dev/sda2
brw-r----- 1 root disk 8,  16 Jul 14 12:22 /dev/sdb
brw-r----- 1 root disk 8,  32 Jul 14 12:22 /dev/sdc
brw-r----- 1 root disk 8,  48 Jul 14 12:22 /dev/sdd
brw-r----- 1 root disk 8,  64 Jul 14 12:22 /dev/sde
brw-r----- 1 root disk 8,  80 Jul 14 12:22 /dev/sdf
brw-r----- 1 root disk 8,  96 Jul 14 12:22 /dev/sdg
brw-r----- 1 root disk 8, 112 Jul 14 12:22 /dev/sdh
brw-r----- 1 root disk 8, 128 Jul 14 12:22 /dev/sdi
brw-r----- 1 root disk 8, 144 Jul 14 12:22 /dev/sdj
[root@newhost ~]#

Devices /dev/sdb through /dev/sdj are our drives we created to be used for ASM. We will need to create partitions on each of these devices using the fdisk command. Device names without a trailing digit such as /dev/sda refer to the whole device, while names with a trailing digit refer to a partition of that whole device.

Execute fdisk passing the command the first device. Use the command (n) to create a new partition. The utility will then ask if you wish to create an extended or primary partition, select (p) for primary. You will then be asked to provide a partition number, select (1). Next you will be asked to first and last cylinder. Hit the enter key to accept the default for each value. The last thing to do is to write the changes enter the (w) command.

Note: If your environment has multiple nodes create the partitions on one node only.

Below is the output of the fdsisk command for the creation of a partition.

[root@newhost ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. 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)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-127, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-127, default 127): 
Using default value 127

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

Calling ioctl() to re-read partition table.
Syncing disks.
[root@newhost ~]#

Follow the same steps for the remaining devices in your environment. Once complete you should see the partitions.

[root@newhost ~]# ls -al /dev/sd*
brw-r----- 1 root disk 8,   0 Jul 14 12:22 /dev/sda
brw-r----- 1 root disk 8,   1 Jul 14 12:22 /dev/sda1
brw-r----- 1 root disk 8,   2 Jul 14 12:22 /dev/sda2
brw-r----- 1 root disk 8,  16 Jul 14 13:17 /dev/sdb
brw-r----- 1 root disk 8,  17 Jul 14 13:17 /dev/sdb1
brw-r----- 1 root disk 8,  32 Jul 14 13:24 /dev/sdc
brw-r----- 1 root disk 8,  33 Jul 14 13:24 /dev/sdc1
brw-r----- 1 root disk 8,  48 Jul 14 13:26 /dev/sdd
brw-r----- 1 root disk 8,  49 Jul 14 13:26 /dev/sdd1
brw-r----- 1 root disk 8,  64 Jul 14 13:27 /dev/sde
brw-r----- 1 root disk 8,  65 Jul 14 13:27 /dev/sde1
brw-r----- 1 root disk 8,  80 Jul 14 15:06 /dev/sdf
brw-r----- 1 root disk 8,  81 Jul 14 15:06 /dev/sdf1
brw-r----- 1 root disk 8,  96 Jul 14 15:09 /dev/sdg
brw-r----- 1 root disk 8,  97 Jul 14 15:09 /dev/sdg1
brw-r----- 1 root disk 8, 112 Jul 14 15:09 /dev/sdh
brw-r----- 1 root disk 8, 113 Jul 14 15:09 /dev/sdh1
brw-r----- 1 root disk 8, 128 Jul 14 15:10 /dev/sdi
brw-r----- 1 root disk 8, 129 Jul 14 15:10 /dev/sdi1
brw-r----- 1 root disk 8, 144 Jul 14 15:17 /dev/sdj
brw-r----- 1 root disk 8, 145 Jul 14 15:17 /dev/sdj1

Install ASMLib

Prior to installing ASMLib you need to verify the kernel version you are using in your environment. The ASM packages are named after the kernel they support. ASMLib requires the following packages: oracleaasmlib and oracleasm-support in addition to the kernel driver. You can verify your kernel version with the uname –r command.

[root@newhost Server]# uname -r
2.6.18-194.el5
[root@newhost Server]#

You can obtain the packages from four sources.

1. Can be downloaded from OTN Oracle ASM Downloads
2. If you are using Oracle Linux, it can be found on the installation media.
3. Oracle UpToDate (requires support subscription)
4. The Oracle Public Yum

The easiest method by far is to use either the Oracle UpToDate or the public yum. In the example below the public yum is used to install oracleasm and all its dependent packages.

[root@newhost ~]# yum install oracleasm
Loaded plugins: security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package oracleasm-2.6.18-194.el5.i686 0:2.0.5-1.el5 set to be updated
--> Processing Dependency: oracleasm-support >= 2.0.0 for package: oracleasm-2.6.18-194.el5
--> Running transaction check
---> Package oracleasm-support.i386 0:2.1.3-1.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================
 Package                             Arch            Version                 Repository              Size
==========================================================================================================
Installing:
 oracleasm-2.6.18-194.el5            i686            2.0.5-1.el5             el5_u5_base             22 k
Installing for dependencies:
 oracleasm-support                   i386            2.1.3-1.el5             el5_u5_base             82 k

Transaction Summary
==========================================================================================================
Install       2 Package(s)
Upgrade       0 Package(s)

Total download size: 104 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): oracleasm-2.6.18-194.el5-2.0.5-1.el5.i686.rpm                               |  22 kB     00:00     
(2/2): oracleasm-support-2.1.3-1.el5.i386.rpm                                      |  82 kB     00:00     
----------------------------------------------------------------------------------------------------------
Total                                                                     178 kB/s | 104 kB     00:00     
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 1e5e0159
el5_u5_base/gpgkey                                                                 | 1.4 kB     00:00     
Importing GPG key 0x1E5E0159 "Oracle OSS group (Open Source Software group) <build@oss.oracle.com>" from http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : oracleasm-support                                                                  1/2 
  Installing     : oracleasm-2.6.18-194.el5                                                           2/2 

Installed:
  oracleasm-2.6.18-194.el5.i686 0:2.0.5-1.el5                                                             

Dependency Installed:
  oracleasm-support.i386 0:2.1.3-1.el5                                                                    

Complete!
[root@newhost ~]# 

Setup ASMLib

With AMSLib installed we next need to configure the driver using oracleasm configure. Execute /etc/init.d/oracleasm configure and provide the default user and group to own the ASM driver interface along with setting the ASM driver to scan for disks and to load at boot.

[root@newhost ~]# /etc/init.d/oracleasm configure
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 []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: Y
Scan for Oracle ASM disks on boot (y/n) [y]: 
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver:                     [  OK  ]
Scanning the system for Oracle ASMLib disks:               [  OK  ]
[root@newhost ~]#

Create the ASM disks

ASM disks are created with the oracleasm createdisk command. The command accepts a string name for the disk along with the device name. When providing the device name pass the device name for the partitions created earlier. Execute /etc/init.d/oracleasm createdisk for disk.

[root@newhost ~]# /etc/init.d/oracleasm createdisk OCRVOTE01 /dev/sdb1
Marking disk "OCRVOTE01" as an ASM disk:                   [  OK  ]
[root@newhost ~]# /etc/init.d/oracleasm createdisk OCRVOTE02 /dev/sdc1
Marking disk "OCRVOTE02" as an ASM disk:                   [  OK  ]
[root@newhost ~]# /etc/init.d/oracleasm createdisk OCRVOTE03 /dev/sdd1
Marking disk "OCRVOTE03" as an ASM disk:                   [  OK  ]
[root@newhost ~]# /etc/init.d/oracleasm createdisk ASMDATA01 /dev/sde1
Marking disk "ASMDATA01" as an ASM disk:                   [  OK  ]
[root@newhost ~]# /etc/init.d/oracleasm createdisk ASMDATA02 /dev/sdf1
Marking disk "ASMDATA02" as an ASM disk:                   [  OK  ]
[root@newhost ~]# /etc/init.d/oracleasm createdisk ASMDATA03 /dev/sdg1
Marking disk "ASMDATA03" as an ASM disk:                   [  OK  ]
[root@newhost ~]# /etc/init.d/oracleasm createdisk ASMDATA04 /dev/sdh1
Marking disk "ASMDATA04" as an ASM disk:                   [  OK  ]
[root@newhost ~]# /etc/init.d/oracleasm createdisk ASMDATA05 /dev/sdi1
Marking disk "ASMDATA05" as an ASM disk:                   [  OK  ]
[root@newhost ~]# /etc/init.d/oracleasm createdisk ASMDATA06 /dev/sdj1
Marking disk "ASMDATA06" as an ASM disk:                   [  OK  ]
[root@newhost ~]#

After creating the disks you can use oracleasm listdisks to list the ASM disks on the system.

[root@newhost ~]# /etc/init.d/oracleasm listdisks
ASMDATA01
ASMDATA02
ASMDATA03
ASMDATA04
ASMDATA05
ASMDATA06
OCRVOTE01
OCRVOTE02
OCRVOTE03
[root@newhost ~]# 

The devices created for ASM can be found under /dev/oracleasm.

[root@newhost ~]# ls -l /dev/oracleasm/disks/*
brw-rw---- 1 oracle dba 8,  65 Jul 18 10:27 /dev/oracleasm/disks/ASMDATA01
brw-rw---- 1 oracle dba 8,  81 Jul 18 10:27 /dev/oracleasm/disks/ASMDATA02
brw-rw---- 1 oracle dba 8,  97 Jul 18 10:27 /dev/oracleasm/disks/ASMDATA03
brw-rw---- 1 oracle dba 8, 113 Jul 18 10:27 /dev/oracleasm/disks/ASMDATA04
brw-rw---- 1 oracle dba 8, 129 Jul 18 10:28 /dev/oracleasm/disks/ASMDATA05
brw-rw---- 1 oracle dba 8, 145 Jul 18 10:28 /dev/oracleasm/disks/ASMDATA06
brw-rw---- 1 oracle dba 8,  17 Jul 18 10:26 /dev/oracleasm/disks/OCRVOTE01
brw-rw---- 1 oracle dba 8,  33 Jul 18 10:26 /dev/oracleasm/disks/OCRVOTE02
brw-rw---- 1 oracle dba 8,  49 Jul 18 10:27 /dev/oracleasm/disks/OCRVOTE03
[root@newhost ~]#

With the ASM disks created you are now ready to create an ASM instance to use these disks or install the Grid Infrastructure.

1 thought on “Preparing Drives for ASM using ASMLib”

  1. This article never shows downloading amslib S/w using yum !
    Did you get it manually ?

    Regards,
    Rst.

Leave a Reply

Your email address will not be published. Required fields are marked *