Add RAW devices for Oracle DB ASM disk for Redhat Enterprise Linux 5 (RHEL5)

Make sure you check on the recommended disk type (block or raw devices for the version of Oracle DB)

Determine the LUN / disks dedicated for RAW devices.
In example below, I already know that my disks for RAW devices is 10 x 32GB each, hence below should be my needed disks.
[root@abc ~]# fdisk -l | grep 34
Disk /dev/xvdd doesn't contain a valid partition table
Disk /dev/xvde doesn't contain a valid partition table
Disk /dev/xvdf doesn't contain a valid partition table
Disk /dev/xvdg doesn't contain a valid partition table
Disk /dev/xvdh doesn't contain a valid partition table
Disk /dev/xvdi doesn't contain a valid partition table
Disk /dev/xvdj doesn't contain a valid partition table
Disk /dev/xvdk doesn't contain a valid partition table
Disk /dev/xvdl doesn't contain a valid partition table
Disk /dev/xvdm doesn't contain a valid partition table
Disk /dev/dm-0 doesn't contain a valid partition table
Disk /dev/dm-1 doesn't contain a valid partition table
Disk /dev/dm-2 doesn't contain a valid partition table
Disk /dev/dm-3 doesn't contain a valid partition table
Disk /dev/dm-4 doesn't contain a valid partition table
Disk /dev/dm-5 doesn't contain a valid partition table
/dev/xvda2              33       19581   157027342+  8e  Linux LVM
Disk /dev/xvdd: 34.3 GB, 34359738368 bytes
Disk /dev/xvde: 34.3 GB, 34359738368 bytes
Disk /dev/xvdf: 34.3 GB, 34359738368 bytes
Disk /dev/xvdg: 34.3 GB, 34359738368 bytes
Disk /dev/xvdh: 34.3 GB, 34359738368 bytes
Disk /dev/xvdi: 34.3 GB, 34359738368 bytes
Disk /dev/xvdj: 34.3 GB, 34359738368 bytes
Disk /dev/xvdk: 34.3 GB, 34359738368 bytes
Disk /dev/xvdl: 34.3 GB, 34359738368 bytes
Disk /dev/xvdm: 34.3 GB, 34359738368 bytes

Now you will need to initialize those disks, command below will wipe out the whole disks, make sure you do it on the right disks
dd if=/dev/zero of=/dev/xvdd count=1
dd if=/dev/zero of=/dev/xvde count=1
dd if=/dev/zero of=/dev/xvdf count=1
dd if=/dev/zero of=/dev/xvdg count=1
dd if=/dev/zero of=/dev/xvdh count=1
dd if=/dev/zero of=/dev/xvdi count=1
dd if=/dev/zero of=/dev/xvdj count=1
dd if=/dev/zero of=/dev/xvdk count=1
dd if=/dev/zero of=/dev/xvdl count=1
dd if=/dev/zero of=/dev/xvdm count=1

Now add them to the /etc/sysconfig/rawdevices to bind them persistently
/dev/raw/raw1 /dev/xvdd
/dev/raw/raw2 /dev/xvde
/dev/raw/raw3 /dev/xvdf
/dev/raw/raw4 /dev/xvdg
/dev/raw/raw5 /dev/xvdh
/dev/raw/raw6 /dev/xvdi
/dev/raw/raw7 /dev/xvdj
/dev/raw/raw8 /dev/xvdk
/dev/raw/raw9 /dev/xvdl
/dev/raw/raw10 /dev/xvdm

Start the “rawdevices” service to read and execute all entries defined above
/etc/init.d/rawdevices start

Make sure it was started upon reboot.
chkconfig rawdevices on

Set the user permission for Oracle DB user to read and write to these raw devices in “/etc/udev/rules.d/60-raw.rules”
ACTION=="add", KERNEL=="raw*", OWNER="oragrid", GROUP="asmadmin", MODE="0660"

Test the permission using “udev_test” command
[root@abc ~]# udevtest /class/raw/raw1
main: looking at device '/devices/virtual/raw/raw1' from subsystem 'raw'
udev_rules_get_name: rule applied, 'raw1' becomes 'raw/raw1'
udev_device_event: device '/devices/virtual/raw/raw1' already in database, validate currently present symlinks
udev_node_add: creating device node '/dev/raw/raw1', major = '162', minor = '1', mode = '0660', uid = '501', gid = '504'
main: run: 'socket:/org/kernel/udev/monitor'
main: run: '/lib/udev/udev_run_devd'
main: run: 'socket:/org/freedesktop/hal/udev_event'
main: run: '/sbin/pam_console_apply /dev/raw/raw1 '

Activate the udev rules to set permission
[root@abc dev]# ll /dev/raw
total 0
crw------- 1 root root 162,  1 May 13 10:08 raw1
crw------- 1 root root 162, 10 May 13 10:08 raw10
crw------- 1 root root 162,  2 May 13 10:08 raw2
crw------- 1 root root 162,  3 May 13 10:08 raw3
crw------- 1 root root 162,  4 May 13 10:08 raw4
crw------- 1 root root 162,  5 May 13 10:08 raw5
crw------- 1 root root 162,  6 May 13 10:08 raw6
crw------- 1 root root 162,  7 May 13 10:08 raw7
crw------- 1 root root 162,  8 May 13 10:08 raw8
crw------- 1 root root 162,  9 May 13 10:08 raw9

[root@abc dev]# start_udev
Starting udev:                                             [  OK  ]

[root@abc dev]# ll /dev/raw
total 0
crw-rw---- 1 oragrid asmadmin 162,  1 May 13 10:08 raw1
crw-rw---- 1 oragrid asmadmin 162, 10 May 13 10:08 raw10
crw-rw---- 1 oragrid asmadmin 162,  2 May 13 10:08 raw2
crw-rw---- 1 oragrid asmadmin 162,  3 May 13 10:08 raw3
crw-rw---- 1 oragrid asmadmin 162,  4 May 13 10:08 raw4
crw-rw---- 1 oragrid asmadmin 162,  5 May 13 10:08 raw5
crw-rw---- 1 oragrid asmadmin 162,  6 May 13 10:08 raw6
crw-rw---- 1 oragrid asmadmin 162,  7 May 13 10:08 raw7
crw-rw---- 1 oragrid asmadmin 162,  8 May 13 10:08 raw8
crw-rw---- 1 oragrid asmadmin 162,  9 May 13 10:08 raw9


Reboot server to make sure you can see the raw devices as above.

No comments: