Tuesday, April 23, 2013

Redhat 6.4 comes with supporting ASM

Exciting with This new feature in Redhat 6.4. I decide to give a test.

Oracle ASMLib Availability and Support

Oracle ASM (Automated Storage Management) is a data volume manager for Oracle databases. ASMLib is an optional utility that can be used on Linux systems to manage Oracle ASM devices. ASMLib consists of the following components:
  • kmod-oracleasm (open-source (GPL) kernel module package)
  • oracleasm-support (open-source (GPL) utilities package)
  • oracleasmlib (proprietary library package)
ASM features and functionality are available without ASMLib. The use of ASMLib does not affect database performance. The ASMLib kernel module package is now available in the Red Hat Enterprise Linux 6 Supplementary RHN channel. Red Hat Enterprise Linux 6 customers who use ASMLib can obtain the other two components using the instructions in the following KnowledgeBase article:
1. Download and install the three packages.
With external help , I managed to download the above saying 3 packages from

https://access.redhat.com/site/solutions/315643

note that:

a.) they can't be found in the supplementary disc(iso file), a bit strange to me, as I thought redhat's document seems quite nice .
b.) only oracleasmlib can be downloaded in Oracle Unbreakable Linux 6, as the rest two are already pre-built into the OS.
c.) It seems no 32bit packages.

For installation, I encoutered no error in CentOS 6.4


[root@localhost Desktop]# ls -lrt *.rpm
-rw-r--r--. 1 root root  35044 Apr 20 01:00 kmod-oracleasm-2.0.6.rh1-2.el6.x86_64.rpm
-rw-r--r--. 1 root root  74984 Apr 20 01:00 oracleasm-support-2.1.8-1.el6.x86_64.rpm
-rw-r--r--. 1 root root  13300 Apr 20 01:00 oracleasmlib-2.0.4-1.el6.x86_64.rpm
[root@localhost Desktop]# rpm -qa |grep oracleasm
[root@localhost Desktop]# rpm -i kmod-oracleasm-2.0.6.rh1-2.el6.x86_64.rpm
warning: kmod-oracleasm-2.0.6.rh1-2.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
[root@localhost Desktop]# rpm -i 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
[root@localhost Desktop]# rpm -i 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


2.  Some basic verification, looks fine.

[root@localhost Desktop]# uname -a
Linux localhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost Desktop]# which oracleasm
/usr/sbin/oracleasm
[root@localhost Desktop]# oracleasm listdisks
[root@localhost Desktop]# oracleasm -V
oracleasm version 2.1.8


For comparing purpose , here is more info for Linux 5.6  ASMLib provided by Oracle.

[root@rac1 ~]# uname -a
Linux rac1.localdomain 2.6.18-238.el5 #1 SMP Tue Jan 4 15:24:05 EST 2011 i686 i686 i386 GNU/Linux
[root@rac1 ~]# which oracleasm
/usr/sbin/oracleasm
[root@rac1 ~]# oracleasm -V
oracleasm version 2.1.4

3. Now add a disk for testing.

3.1 fdisk info before add a new disk.
[root@localhost Desktop]#  fdisk -l

Disk /dev/sda: 34.6 GB, 34625028096 bytes
255 heads, 63 sectors/track, 4209 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: 0x0000bdcd

   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        4210    33300480   8e  Linux LVM

Disk /dev/mapper/VolGroup-lv_root: 31.6 GB, 31578914816 bytes
255 heads, 63 sectors/track, 3839 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/VolGroup-lv_swap: 2516 MB, 2516582400 bytes
255 heads, 63 sectors/track, 305 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

[root@localhost Desktop]# shutdown -h now


--after reboot the new disk is /dev/sdb


[root@localhost ~]# fdisk -l

Disk /dev/sda: 34.6 GB, 34625028096 bytes
255 heads, 63 sectors/track, 4209 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: 0x0000bdcd

   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        4210    33300480   8e  Linux LVM

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 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/VolGroup-lv_root: 31.6 GB, 31578914816 bytes
255 heads, 63 sectors/track, 3839 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/VolGroup-lv_swap: 2516 MB, 2516582400 bytes
255 heads, 63 sectors/track, 305 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

[root@localhost ~]# ls -l /dev/oracleasm
ls: cannot access /dev/oracleasm: No such file or directory
[root@localhost ~]# 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 0xb9020b75.
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): p

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 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: 0xb9020b75

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

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

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

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# fdisk -l /dev/sdb

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 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: 0xb9020b75

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1044     8385898+  83  Linux


4. Things before proper configure and load the asmlib

[root@localhost ~]# oracleasm listdisks


[root@localhost ~]# oracleasm createdisk -help
Usage: oracleasm-createdisk [-l ] [-v]


[root@localhost ~]# ls -l /usr/lib/oracleasm/oracleasm*
-rwxr-xr-x. 1 root root  9840 Feb  9 06:46 /usr/lib/oracleasm/oracleasm-candidate-p
-rwxr-xr-x. 1 root root  9920 Feb  9 06:46 /usr/lib/oracleasm/oracleasm-clean-disk
-rwxr-xr-x. 1 root root 10006 Feb  9 06:44 /usr/lib/oracleasm/oracleasm-configure
-rwxr-xr-x. 1 root root  2964 Feb  9 06:44 /usr/lib/oracleasm/oracleasm-createdisk
-rwxr-xr-x. 1 root root  2676 Feb  9 06:44 /usr/lib/oracleasm/oracleasm_debug_link
-rwxr-xr-x. 1 root root  3785 Feb  9 06:44 /usr/lib/oracleasm/oracleasm-deletedisk
-rwxr-xr-x. 1 root root  2039 Feb  9 06:44 /usr/lib/oracleasm/oracleasm-dropdisks
-rwxr-xr-x. 1 root root  2142 Feb  9 06:44 /usr/lib/oracleasm/oracleasm-exit
-rwxr-xr-x. 1 root root  2796 Feb  9 06:44 /usr/lib/oracleasm/oracleasm-get-driver
-rwxr-xr-x. 1 root root  3543 Feb  9 06:44 /usr/lib/oracleasm/oracleasm-init
-rwxr-xr-x. 1 root root  9928 Feb  9 06:46 /usr/lib/oracleasm/oracleasm-instantiate-disk
-rwxr-xr-x. 1 root root   812 Feb  9 06:44 /usr/lib/oracleasm/oracleasm-listdisks
-rwxr-xr-x. 1 root root  3862 Feb  9 06:44 /usr/lib/oracleasm/oracleasm-querydisk
-rwxr-xr-x. 1 root root 12352 Feb  9 06:46 /usr/lib/oracleasm/oracleasm-read-label
-rwxr-xr-x. 1 root root  7016 Feb  9 06:46 /usr/lib/oracleasm/oracleasm-reload-partitions
-rwxr-xr-x. 1 root root  6081 Feb  9 06:44 /usr/lib/oracleasm/oracleasm-renamedisk
-rwxr-xr-x. 1 root root  3506 Feb  9 06:44 /usr/lib/oracleasm/oracleasm-scandisks
-rwxr-xr-x. 1 root root  9480 Feb  9 06:46 /usr/lib/oracleasm/oracleasm-scan-partitions
-rwxr-xr-x. 1 root root  1143 Feb  9 06:44 /usr/lib/oracleasm/oracleasm-status
-rwxr-xr-x. 1 root root  2865 Feb  9 06:44 /usr/lib/oracleasm/oracleasm-update-driver
-rwxr-xr-x. 1 root root  6794 Feb  9 06:44 /usr/lib/oracleasm/oracleasm-update-driver-otn
-rwxr-xr-x. 1 root root  2480 Feb  9 06:44 /usr/lib/oracleasm/oracleasm-update-driver-uln
-rwxr-xr-x. 1 root root 12352 Feb  9 06:46 /usr/lib/oracleasm/oracleasm-write-label
-rwxr-xr-x. 1 root root  3768 Feb  9 06:44 /usr/lib/oracleasm/oracleasm-Xshlib
[root@localhost ~]#  /usr/lib/oracleasm/oracleasm-createdisk TestVOL1 /dev/sdb1
/usr/lib/oracleasm/oracleasm-createdisk: line 52: oracleasm-Xshlib: No such file or directory
/usr/lib/oracleasm/oracleasm-createdisk: line 160: upper_disk: command not found


5. Then realized , need to configure and load the ASMLib first.

[root@localhost Desktop]# oracleasm configure
ORACLEASM_ENABLED=false
ORACLEASM_UID=
ORACLEASM_GID=
ORACLEASM_SCANBOOT=true
ORACLEASM_SCANORDER=""
ORACLEASM_SCANEXCLUDE=""
ORACLEASM_USE_LOGICAL_BLOCK_SIZE="false"
[root@localhost Desktop]#  /usr/lib/oracleasm/oracleasm-createdisk TestVOL1 /dev/sdb1
/usr/lib/oracleasm/oracleasm-createdisk: line 52: oracleasm-Xshlib: No such file or directory
/usr/lib/oracleasm/oracleasm-createdisk: line 160: upper_disk: command not found
[root@localhost Desktop]# ps -ef |grep asm
root      2485  2454  0 22:29 pts/0    00:00:00 grep asm
[root@localhost Desktop]# oracleasm status
Checking if ASM is loaded: no
Checking if /dev/oracleasm is mounted: no
[root@localhost Desktop]# oracleasm init
Creating /dev/oracleasm mount point: /dev/oracleasm
Loading module "oracleasm": oracleasm
Mounting ASMlib driver filesystem: /dev/oracleasm
[root@localhost Desktop]# ps -ef |grep asm
root      2552  2454  0 22:29 pts/0    00:00:00 grep asm
[root@localhost Desktop]# oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes


6. still encounter error.

[root@localhost Desktop]# oracleasm createdisk TestVol1 /dev/sdb1Writing disk header: done
Instantiating disk: failed
Clearing disk header: done
[root@localhost Desktop]# oracleasm listdisks
[root@localhost Desktop]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...


[root@localhost Desktop]# cd /etc/init.d
[root@localhost init.d]# ls oracle*
oracleasm
[root@localhost init.d]# ls -l oracle*
-rwxr-xr-x. 1 root root 7124 Feb  9 06:44 oracleasm
[root@localhost init.d]# ./oracleasm createdisk TestVol1 /dev/sdb1
Marking disk "TestVol1" as an ASM disk:                    [FAILED]
[root@localhost init.d]# echo $?
1
[root@localhost init.d]#  /usr/lib/oracleasm/oracleasm-createdisk TestVOL1 /dev/sdb1
/usr/lib/oracleasm/oracleasm-createdisk: line 52: oracleasm-Xshlib: No such file or directory
/usr/lib/oracleasm/oracleasm-createdisk: line 160: upper_disk: command not found
[root@localhost init.d]#

7. then I google for racleasm-Xshlib , and I found it is inside oracleasm-support package.

[root@localhost Desktop]# rpm -ql oracleasm-support-2.1.8-1.el6.x86_64.rpm
package oracleasm-support-2.1.8-1.el6.x86_64.rpm is not installed
[root@localhost Desktop]# rpm -ql oracleasm-support-2.1.8-1.el6.x86_64
/etc/init.d/oracleasm
/etc/sysconfig/oracleasm
/usr/lib/oracleasm
/usr/lib/oracleasm/oracleasm-Xshlib
/usr/lib/oracleasm/oracleasm-candidate-p
/usr/lib/oracleasm/oracleasm-clean-disk
/usr/lib/oracleasm/oracleasm-configure
/usr/lib/oracleasm/oracleasm-createdisk
/usr/lib/oracleasm/oracleasm-deletedisk
/usr/lib/oracleasm/oracleasm-dropdisks
/usr/lib/oracleasm/oracleasm-exit
/usr/lib/oracleasm/oracleasm-get-driver
/usr/lib/oracleasm/oracleasm-init
/usr/lib/oracleasm/oracleasm-instantiate-disk
/usr/lib/oracleasm/oracleasm-listdisks
/usr/lib/oracleasm/oracleasm-querydisk
/usr/lib/oracleasm/oracleasm-read-label
/usr/lib/oracleasm/oracleasm-reload-partitions
/usr/lib/oracleasm/oracleasm-renamedisk
/usr/lib/oracleasm/oracleasm-scan-partitions
/usr/lib/oracleasm/oracleasm-scandisks
/usr/lib/oracleasm/oracleasm-status
/usr/lib/oracleasm/oracleasm-update-driver
/usr/lib/oracleasm/oracleasm-update-driver-otn
/usr/lib/oracleasm/oracleasm-update-driver-uln
/usr/lib/oracleasm/oracleasm-write-label
/usr/lib/oracleasm/oracleasm_debug_link
/usr/sbin/asmscan
/usr/sbin/asmtool
/usr/sbin/oracleasm
/usr/share/doc/oracleasm-support-2.1.8
/usr/share/doc/oracleasm-support-2.1.8/ReleaseNotes
/usr/share/man
/usr/share/man/man8
/usr/share/man/man8/oracleasm-configure.8.gz
/usr/share/man/man8/oracleasm-createdisk.8.gz
/usr/share/man/man8/oracleasm-deletedisk.8.gz
/usr/share/man/man8/oracleasm-dropdisks.8.gz
/usr/share/man/man8/oracleasm-exit.8.gz
/usr/share/man/man8/oracleasm-help.8.gz
/usr/share/man/man8/oracleasm-init.8.gz
/usr/share/man/man8/oracleasm-listdisks.8.gz
/usr/share/man/man8/oracleasm-querydisk.8.gz
/usr/share/man/man8/oracleasm-renamedisk.8.gz
/usr/share/man/man8/oracleasm-scandisks.8.gz
/usr/share/man/man8/oracleasm-status.8.gz
/usr/share/man/man8/oracleasm-update-driver-otn.8.gz
/usr/share/man/man8/oracleasm-update-driver-uln.8.gz
/usr/share/man/man8/oracleasm-update-driver.8.gz
/usr/share/man/man8/oracleasm.8.gz
/usr/share/man/man8/oracleasm.init.8.gz

8. but why oracleasm-createdisk can't find it?! even I execute in the /usr/lib/oracleasm, evenmore I include "./" to $PATH.

[root@localhost oracleasm]# ls -l *Xshlib
-rwxr-xr-x. 1 root root 3768 Feb  9 06:44 oracleasm-Xshlib
[root@localhost oracleasm]#  /usr/lib/oracleasm/oracleasm-createdisk -v TestVOL1 /dev/sdb1
line 76: oracleasm-candidate-p: command not found
[root@localhost oracleasm]# ls -l *candi*
-rwxr-xr-x. 1 root root 9840 Feb  9 06:46 oracleasm-candidate-p
-rwxr-xr-x. 1 root root 3506 Feb  9 06:44 oracleasm-scandisks
[root@localhost oracleasm]# ./oracleasm-createdisk -v TestVOL1 /dev/sdb1line 76: oracleasm-candidate-p: command not found
[root@localhost oracleasm]# ehoc $PATH
bash: ehoc: command not found
[root@localhost oracleasm]# echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin
[root@localhost oracleasm]# export PATH=./:$PATH
[root@localhost oracleasm]# ./oracleasm-createdisk -v TestVOL1 /dev/sdb1
Disk "TESTVOL1" does not exist or is not instantiated
Writing disk header: done
Instantiating disk: oracleasm-instantiate-disk: Unable to create ASM disk "TESTVOL1": Permission denied

failed
Clearing disk header: done


9. Now I get a new error message, goolged again for Instantiating disk: oracleasm-instantiate-disk: Unable to create ASM disk "TESTVOL1": Permission denied.

Although I am running as root, still compared the permission of /dev/oracleasm and subdirectories, which is same my another vm of CentOS 5.6.

By luck, I found the following two links, which is saying caused by SELINUX.

http://dbaforums.org/oracle/index.php?showtopic=21688
http://www.dba-oracle.com/t_asm_disk_does_not_exist_or_is_not_instantiated.htm





10. now follow the instruciton to disable SELINUX.

[root@localhost oracleasm]# cat /etc/sysconfig/selinux

# 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=enforcing
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted


[root@localhost oracleasm]# vi /etc/sysconfig/selinux
[root@localhost oracleasm]# cat /etc/sysconfig/selinux

# 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=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

--after reboot

[root@localhost ~]# which getenforce
/usr/sbin/getenforce
[root@localhost ~]# getenforce Disabled
Disabled
[root@localhost ~]# ps -ef |grep -i asm
root      2620  2604  0 23:28 pts/0    00:00:00 grep -i asm
[root@localhost ~]# cd /etc/init.d
[root@localhost init.d]# ./oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes

11. Cheers!

[root@localhost ~]# oracleasm createdisk TestVOL1 /dev/sdb1
Writing disk header: done
Instantiating disk: done
[root@localhost ~]# oracleasm listdisks
TESTVOL1
[root@localhost ~]# oracleasm querydisk Testvol1
Disk "TESTVOL1" is a valid ASM disk

[root@localhost ~]# oracleasm querydisk -p Testvol1
Disk "TESTVOL1" is a valid ASM disk
/dev/sdb1: LABEL="TESTVOL1" TYPE="oracleasm"


oot@localhost ~]# cd /etc/init.d
[root@localhost init.d]# ls -ld /dev/oracleasm
drwxr-xr-x 4 root root 0 Apr 22 23:21 /dev/oracleasm
[root@localhost init.d]# ls -ld /dev/oracleasm/
drwxr-xr-x 4 root root 0 Apr 22 23:21 /dev/oracleasm/
[root@localhost init.d]# ls -l /dev/oracleasm/
total 0
drwxr-xr-x 1 root   root   0 Apr 22 23:21 disks
drwxrwx--- 1 oracle oracle 0 Apr 22 23:21 iid
[root@localhost init.d]# ls -l /dev/oracleasm/disks
total 0
brw-rw---- 1 oracle oracle 8, 17 Apr 22 23:30 TESTVOL1
[root@localhost init.d]# ls -l /dev/oracleasm/iid
total 0



12. Thought

So what will happen to ASMLib next (from competing of Oracle and RedHat)?

No comments:

Post a Comment