Tuesday 26 February 2013

Creating ASM disks using udev in RHEL 6.2



For RHEL6 or Oracle Linux 6, Oracle will only provide ASMLib software and updates when configured Unbreakable Enterprise Kernel (UEK). Oracle will not provide ASMLib packages for kernels distributed by Red Hat as part of RHEL 6 or the Red Hat compatible kernel in Oracle Linux 6. ASMLib updates will be delivered via Unbreakable Linux Network(ULN) which is available to customers with Oracle Linux support. ULN works with both Oracle Linux or Red Hat Linux installations, but ASMlib usage will require replacing any Red Hat kernel with UEK

Therefore use Linux udev to create ASM disk in RHEL 6.2

Steps to create ASM disk using udev

1. Partition the given LUN using fdisk or parted. In our example we have created multiple partition on a single LUN.

Disk /dev/sda: 61.4 GB, 61440262144 bytes
64 heads, 32 sectors/track, 58594 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b7104

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       10241    10486768   83  Linux
/dev/sda2           10242       20482    10486784   83  Linux


2. The device attributes used in the udev rules template are found by running the following
command on each device (here as an example, /dev/sda) and substituting the corresponding
values in the example below:

[root@coltdb01 ~]# scsi_id --page=0x83 --whitelisted --device=/dev/sda
3600c0ff000d7daf2c0588a5001000000

3. With this information, you can isolate the disk devices to be used by ASM to their own
directory (/dev/oracleasm/disks), and automatically change their ownership and access permission so that ASM can read them. Create a new file, /etc/udev/rules.d/99-asm.rules, with contents similar to the following


If you have multiple partitions on a single LUN, you can mention as below

vi 99-asm.rules

# What: oracle database: devices to be used by ASM
## Important: each rule must either be a single line or extend to multiple lines with backslashes.

KERNEL=="sda1", PROGRAM=="scsi_id --page=0x83 --whitelisted --device=/dev/%k", \
RESULT=="3600c0ff000d7daf2c0588a5001000000", \
SYMLINK+="oracleasm/disks/DSK1", OWNER="oracle", GROUP="dba", MODE="0660"

KERNEL=="sda2", PROGRAM=="scsi_id --page=0x83 --whitelisted --device=/dev/%k", \
RESULT=="3600c0ff000d7daf2c0588a5001000000", \
SYMLINK+="oracleasm/disks/DSK2", OWNER="oracle", GROUP="dba", MODE="0660"

If you have single partition on each LUN, you can mention as follow

vi 99-asm.rules

# What: oracle database: devices to be used by ASM
## Important: each rule must either be a single line or extend to multiple lines with backslashes.

KERNEL=="sd*", PROGRAM=="scsi_id --page=0x83 --whitelisted --device=/dev/%k", \
RESULT=="3600605b00162840001e285f91316df21", \
SYMLINK+="oracleasm/disks/DSK1", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sd*", PROGRAM=="scsi_id --page=0x83 --whitelisted --device=/dev/%k", \
RESULT=="360080e50001c2c8600001a254eeb7a3d", \
SYMLINK+="oracleasm/disks/DSK2", OWNER="oracle", GROUP="dba", MODE="0660"

These rules will take effect after the next reboot.

4. You can see the disks created on node under /dev/oracleasm/disks

[root@coltdb01 disks]# cd /dev/oracleasm/disks
[root@coltdb01 disks]# ls -tlr
total 0
lrwxrwxrwx 1 root root 10 Feb 26 16:36 DSK2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Feb 26 16:36 DSK1 -> ../../sda1

5. The disks created using udev are visible in the installation once you change your "Disk Discovery Path"





6. Occasionally, when reusing a LUN, ASM may detect a previous disk header and refuse to
reuse the disk. If that is the case, clear the header by writing 25 MB of nulls, and repartition
the LUN. For example:

# dd if=/dev/zero of=/dev/oracleasm/disks/DSK1 bs=1M count=25