ORACLE ASMLIB
This blog post is more of a note for myself on configuring ASMLib.
ASMLib is an optional utility that can be used on Linux systems to manage Oracle ASM devices.
ASMLib consists of the following components:
An open source (GPL) kernel module package: kmod-oracleasm
An open source (GPL) utilities package: oracleasm-support
A closed source (proprietary) library package: oracleasmlib
On my Oracle VMBox, I performed the below steps –
1. Check the installed packages related to oracleasm
[[email protected] dev]# rpm -qa | grep oracleasm
[[email protected] dev]#
2. As no rpm were installed, I started installing the packages
[[email protected] dev]# yum install oracleasm-support
Loaded plugins: refresh-packagekit, security, ulninfo
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package oracleasm-support.x86_64 0:2.1.8-1.el6 will be installed
--> Finished Dependency Resolution
..........................
Installed:
oracleasm-support.x86_64 0:2.1.8-1.el6
Complete!
[[email protected] dev]#
[[email protected] dev]# yum install kmod-oracleasm
Loaded plugins: refresh-packagekit, security, ulninfo
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package kmod-oracleasm.x86_64 0:2.0.8-13.el6_8 will be installed
--> Processing Dependency: kernel >= 2.6.32-642.el6 for package: kmod-oracleasm-2.0.8-13.el6_8.x86_64
...........................
Is this ok [y/N]: y
Downloading Packages:
(1/2): kernel-2.6.32-642.el6.x86_64.rpm
(2/2): kmod-oracleasm-2.0.8-13.el6_8.x86_64.rpm
...........................
Installed:
kmod-oracleasm.x86_64 0:2.0.8-13.el6_8
Dependency Installed:
kernel.x86_64 0:2.6.32-642.el6
Complete!
[[email protected] dev]#
3. Download the oracleasmlib rpm from http://www.oracle.com/technetwork/server-storage/linux/asmlib/rhel6-1940776.html and install it. Without this RPM, you will not have the oracleasm-discover executable
[[email protected] dev]# ls -lrt /media/sf_12cR1/oracleasmlib*
-rwxrwx--- 1 root vboxsf 13336 May 18 21:44 oracleasmlib-2.0.12-1.el6.x86_64.rpm
[[email protected] sf_12cR1]# rpm -ihv oracleasmlib-2.0.12-1.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:oracleasmlib ########################################### [100%]
[[email protected] sf_12cR1]#
4. Verify all the components are installed
[[email protected] sf_12cR1]# rpm -qa | grep oracleasm
oracleasm-support-2.1.8-1.el6.x86_64
oracleasmlib-2.0.12-1.el6.x86_64
kmod-oracleasm-2.0.8-13.el6_8.x86_64
[[email protected] sf_12cR1]# cd
[[email protected] ~]# which oracleasm
/usr/sbin/oracleasm
[[email protected] ~]#
5. Configure oracleasm — will configure the on-boot properties of the Oracle ASM library driver as well as set the appropriate file permissions.
[[email protected] dev]# 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 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 []: oinstall
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
[[email protected] dev]#
The configuration setting done above, can be checked in /etc/sysconfig/oracleasm
[[email protected] dev]# ls -lrt /etc/sysconfig/oracleasm
lrwxrwxrwx 1 root root 24 May 18 22:02 /etc/sysconfig/oracleasm -> oracleasm-_dev_oracleasm
6. Check the status
[[email protected] ~]# oracleasm status
Checking if ASM is loaded: no
Checking if /dev/oracleasm is mounted: no
[[email protected] ~]#
7. Load oracleasm module with the init command
[[email protected] ~]# 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
[[email protected] ~]#
8. Verify the oracleasm configuration
a. Perform ‘df –ha’, this should show you that /dev/oracleasmfs is mounted.
[[email protected] ~]# df -ha
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_oel6712c-lv_root
45G 7.4G 36G 18% /
....................
oracleasmfs 0 0 0 - /dev/oracleasm
b. Execute the ‘lsmod’ command, to show the loaded oracleasm module.
[[email protected] ~]# lsmod | grep oracleasm
Module Size Used by
oracleasm 53591 1
9. Create the partition on disk , if not already done
[[email protected] oracleasm]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 50G 0 disk
├─sda1 8:1 0 500M 0 part /boot
└─sda2 8:2 0 49.5G 0 part
├─vg_oel6712c-lv_root (dm-0) 252:0 0 45.6G 0 lvm /
└─vg_oel6712c-lv_swap (dm-1) 252:1 0 3.9G 0 lvm [SWAP]
sdb 8:16 0 10G 0 disk
sdc 8:32 0 12G 0 disk
sdd 8:48 0 12G 0 disk
sde 8:64 0 10G 0 disk
sdf 8:80 0 12G 0 disk
sr0 11:0 1 55.5M 0 rom /media/VBOXADDITIONS_5.0.20_106931
[[email protected] disks]# 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 0x50e6a869.
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)
p
Partition number (1-4):
Value out of range.
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder, cylinders or size{K,M,G} (1-1305, default 1305):
Using default value 1305
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[[email protected] disks]#
[[email protected] disks]#
[[email protected] disks]#
[[email protected] disks]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 50G 0 disk
├─sda1 8:1 0 500M 0 part /boot
└─sda2 8:2 0 49.5G 0 part
├─vg_oel6712c-lv_root (dm-0) 252:0 0 45.6G 0 lvm /
└─vg_oel6712c-lv_swap (dm-1) 252:1 0 3.9G 0 lvm [SWAP]
sdb 8:16 0 10G 0 disk
└─sdb1 8:17 0 10G 0 part
sdc 8:32 0 12G 0 disk
sdd 8:48 0 12G 0 disk
sde 8:64 0 10G 0 disk
sdf 8:80 0 12G 0 disk
sr0 11:0 1 55.5M 0 rom /media/VBOXADDITIONS_5.0.20_106931
Perform the same above steps for remaining disk.
10. Once the disk are created, label the disks as ASM disks and give then an ASM name.
[[email protected] disks]# oracleasm createdisk data0101 /dev/sdb1
Writing disk header: done
Instantiating disk: done
[[email protected] disks]# oracleasm createdisk data0102 /dev/sde1
Writing disk header: done
Instantiating disk: done
[[email protected] disks]# ls -lrt
total 0
brw-rw---- 1 oracle oinstall 8, 17 May 18 22:49 DATA0101
brw-rw---- 1 oracle oinstall 8, 65 May 18 22:50 DATA0102
11. Check the configured disk using listdisks
[[email protected] disks]# oracleasm listdisks
DATA0101
12. You can query the disk to check if its a valid ASM Disk
[[email protected] disks]# oracleasm querydisk -d DATA0101
Disk "DATA0101" is a valid ASM disk on device [8,17]
[[email protected] disks]# more /proc/partitions
major minor #blocks name
8 17 10482381 sdb1
[[email protected] sbin]# blkid|grep asm
/dev/sdb1: LABEL="DATA0101" TYPE="oracleasm"
/dev/sde1: LABEL="DATA0102" TYPE="oracleasm"
[[email protected] sbin]#
The [8,17] is the major,minor number of the device with this partition. The value comes from /proc/partitions
major — The major number of the device with this partition. The major number in the /proc/partitions, (3), corresponds with the block device ide0, in /proc/devices.
minor — The minor number of the device with this partition. This serves to separate the partitions into different physical devices and relates to the number at the end of the name of the partition.
#blocks — Lists the number of physical disk blocks contained in a particular partition.
name — The name of the partition.
13. oracleasm-discover
[[email protected] sbin]# oracleasm-discover
-bash: /usr/sbin/oracleasm-discover: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
For the above error install/lib/ld-linux.so.2
[[email protected] ~]# yum install /lib/ld-linux.so.2 Loaded plugins: refresh-packagekit, security, ulninfo Setting up Install Process public_ol6_latest/filelists | 61 MB 00:43 Resolving Dependencies --> Running transaction check ---> Package glibc.i686 0:2.12-1.192.el6 will be installed Dependencies Resolved .................. Complete! [[email protected] ~]# [[email protected] ~]# ls -lrt /lib/ld-linux.so.2 lrwxrwxrwx 1 root root 10 May 18 23:25 /lib/ld-linux.so.2 -> ld-2.12.so [[email protected] ~]# [[email protected] ~]# oracleasm-discover Using ASMLib from /opt/oracle/extapi/32/asm/orcl/1/libasm.so [ASM Library - Generic Linux, version 2.0.4 (KABI_V2)] Discovered disk: ORCL:DATA0101 [20964762 blocks (10733958144 bytes), maxio 512] Discovered disk: ORCL:DATA0102 [20964762 blocks (10733958144 bytes), maxio 512] [[email protected] ~]#