Saturday, January 17, 2015

Creating ASM Disks using ASMLib

While installing oracle 11.2.0.4 grid infrastructure (same is true for 12c) on Oracle Linux 6 (x86_64), “Create ASM Disk Group” screen of installation wizard prompted to select the disks for the creation of a diskgroup, as you see in bellow screenshot. This installation screen would appear if you select “Install and Configure Grid Infrastructure for a Cluster
” or “Install and Configure Grid Infrastructure for a Stand Alone Server” option from the first screen of installer.



























I realized that although disks have been provisioned but I have not created ASM disks using ASMLib and that is the reason no disks are listed which can be selected. So I thought that I should share with you the method of preparing ASM disks using ASMLib, so that diskgroups could be created using these ASM disks. Alternatively you can think of configure and use raw devices using UDEV on Linux 5 and above and “rawdevices” service for Linux 4 or bellow. For Windows, you would need asmtool.exe or asmtoolg.exe to stamp the disks before being used for ASM diskgroups.  

Note that creation of ASM disks is required to create  independent of what version of Oracle ASM/RDBMS you are going to use, or whether it is for a RAC or standby alone server. So this method should work for any 10g/11g/12c version of ASM.

First we need to find out which disks have been provisioned for the ASM. In the following, highlighted in bold are the disks which have been provisioned for the ASM.

[root@salman1 oracle]# ls -l /dev/sd*
brw-rw---- 1 root disk 8,   0 Dec 23 15:24 /dev/sda
brw-rw---- 1 root disk 8,   1 Dec 23 15:24 /dev/sda1
brw-rw---- 1 root disk 8,   2 Dec 23 15:24 /dev/sda2
brw-rw---- 1 root disk 8,  16 Dec 23 15:24 /dev/sdb
brw-rw---- 1 root disk 8,  17 Dec 23 15:24 /dev/sdb1
brw-rw---- 1 root disk 8,  32 Dec 23 15:52 /dev/sdc
brw-rw---- 1 root disk 8,  48 Dec 23 15:52 /dev/sdd
brw-rw---- 1 root disk 8,  64 Dec 23 15:52 /dev/sde

Create disk partitions as follows. If you are not familiar with fdisk, you can simply execute “fdisk /dev/sdc” command (sdc should be replaced with the disk you want to partition) and then enter following in sequence
n, p, 1, <enter>, <enter>, w. And you are done with creating /dev/sdc1 partition. See bellow example.
[root@salman1 oracle]# fdisk /dev/sdc

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): 1
First cylinder (1-261, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-261, default 261):
Using default value 261

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

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

Repeat same for /dev/sdd and /dev/sde

Next step is to create the ASM disk using “oracleasm”. I am using Oracle Linux 6 which already has Oracle ASMLib driver in it. If you don’t have this in your Linux,you can download it from http://www.oracle.com/technetwork/server-storage/linux/downloads/index-088143.html and install.

In the following you can see how to create ASM disks using oracleasm command (as root). I am creating 3 disks, one for my diskgroup CRS and 2 for my diskgroup DATA. Choosing a name of disk similar to the diskgroup name makes it easier to recognize the disks we intend to use for a specific diskgorup

[root@salman1 oracle]# oracleasm version
oracleasm version 2.1.8

[root@salman1 oracle]# oracleasm createdisk CRS1 /dev/sdc1
Writing disk header: done
Instantiating disk: done
[root@salman1 oracle]# oracleasm createdisk DATA1 /dev/sdd1
Writing disk header: done
Instantiating disk: done
[root@salman1 oracle]# oracleasm createdisk DATA2 /dev/sde1
Writing disk header: done
Instantiating disk: done
[root@salman1 oracle]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
[root@salman1 oracle]# oracleasm listdisks
CRS1
DATA1
DATA2
[root@salman1 oracle]#

Once this is done, these disks would appear as candidate disks in the Grid Infrastructure installation wizard (also in ASM Configuration Assistant tool i.e. asmca ), If I re-initiate the installer




























No comments:

Post a Comment

Popular Posts - All Times