Zahid Karim
Recent Posts
1.Draw plus and cross sign into PDF via PLSQL using PL_FPDF
2.Draw Triangle directly into PDF via PLSQL using PL_FPDF
3.Write fast and efficient PLSQL - DBMS_PROFILER
4.Fix physically corrupt data blocks using PLSQL - DBMS_REPAIR
5.Encrypt or Decrypt sensitive data using PLSQL - DBMS_CRYPTO
Find me on
Recyclebin with Flashback Table in Oracle 10g Automatic Shared Memory Management in Oracle 10g

How to configure Raw Disks in RHEL 5

Posted by Zahid on October 19, 2009.

Configuring raw disks on RHEL 4 was done via the rawdevices service, which seems to be unavailable on RHEL 5.0 and 5.1. I haven't checked RHEL 5.2 and 5.3, but 5.4 and 5.5 do have it back. Here I will demonstrate how can we use "UDEV" to configure raw devices on RHEL 5.0 and 5.1.

This article assumes that you have attached the disks to your machine already. The first step to configure a raw devices to use with Oracle ASM is to partition the disks but not format them, since formatting will put a file system on them.

# ls /dev/sd* /dev/sda /dev/sda2 /dev/sda4 /dev/sda6 /dev/sdc /dev/sde /dev/sdg /dev/sda1 /dev/sda3 /dev/sda5 /dev/sdb /dev/sdd /dev/sdf # cat /proc/partitions major minor #blocks name 8 0 26214400 sda 8 1 104391 sda1 8 2 10482412 sda2 8 3 3148740 sda3 8 4 1 sda4 8 5 1052226 sda5 8 6 11422183 sda6 8 16 4194304 sdb 8 32 4194304 sdc 8 48 4194304 sdd 8 64 4194304 sde 8 80 4194304 sdf 8 96 4194304 sdg /* Since we added SCSI disks so you should see them in /dev/sd*. sda is our main disk where OS and other apps are installed and sda1 to sda6 are its partitions. sdb to sdg are the new 6 disks that we have just added. The output from 'cat /proc/partitions' shows they are not partitioned yet. We have to create at least one partition in each disk. We can have more then one partitions and use each partition as a different ASM disk. I am going to create one partition in each disk. */ # fdisk /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel. 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) Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-522, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-522, default 522): Using default value 522 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.

Repeat the fdisk operation for all 6 disks in the same way as demonstrated above.

# cat /proc/partitions major minor #blocks name 8 0 26214400 sda 8 1 104391 sda1 8 2 10482412 sda2 8 3 3148740 sda3 8 4 1 sda4 8 5 1052226 sda5 8 6 11422183 sda6 8 16 4194304 sdb 8 17 4192933 sdb1 8 32 4194304 sdc 8 33 4192933 sdc1 8 48 4194304 sdd 8 49 4192933 sdd1 8 64 4194304 sde 8 65 4192933 sde1 8 80 4194304 sdf 8 81 4194304 sdf1 8 96 4194304 sdg 8 97 4194304 sdg1 #

Verify that you have one partition for every disk.

Open /etc/udev/rules.d/60-raw.rules and put these lines there for 6 disks

ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N" ACTION=="add", KERNEL=="sdc1", RUN+="/bin/raw /dev/raw/raw2 %N" ACTION=="add", KERNEL=="sdd1", RUN+="/bin/raw /dev/raw/raw3 %N" ACTION=="add", KERNEL=="sde1", RUN+="/bin/raw /dev/raw/raw4 %N" ACTION=="add", KERNEL=="sdf1", RUN+="/bin/raw /dev/raw/raw5 %N" ACTION=="add", KERNEL=="sdg1", RUN+="/bin/raw /dev/raw/raw6 %N" # set permissions on these disks for the Oracle Owner user. ACTION=="add", KERNEL=="raw*", OWNER=="oracle", GROUP=="oinstall", MODE=="0660"

Run following commands to bound raw disks:

$ /bin/raw /dev/raw/raw1 /dev/sdb1 $ /bin/raw /dev/raw/raw2 /dev/sdc1 $ /bin/raw /dev/raw/raw3 /dev/sdd1 $ /bin/raw /dev/raw/raw4 /dev/sde1 $ /bin/raw /dev/raw/raw5 /dev/sdf1 $ /bin/raw /dev/raw/raw6 /dev/sdg1

Test the raw devices setup before starting udev:

# udevtest /block/sdb/sdb1 | grep raw main: run: '/bin/raw /dev/raw/raw1 /dev/.tmp-8-17' # udevtest /class/raw/raw1 | grep mode udev_node_add: creating device node '/dev/raw/raw1', major = '162', minor = '1', mode = '0660', uid = '500', gid = '500'

uid=500 is the user id for user oracle and gid=500 is the group id for oinstall group. So it seems we have setup raw disks correctly.
Now start udev:

# start_udev Starting udev: [ OK ]

Verify the disks are bond to raw device:

# raw -qa /dev/raw/raw1: bound to major 8, minor 17 /dev/raw/raw2: bound to major 8, minor 33 /dev/raw/raw3: bound to major 8, minor 49 /dev/raw/raw4: bound to major 8, minor 65 /dev/raw/raw5: bound to major 8, minor 81 /dev/raw/raw6: bound to major 8, minor 97

If you see all of your raw devices configured here with their correct major and minor numbers, then you are good to go ahead and start ASM installation.

See also:
How to install ASM instance on a non-asm Oracle database
How to migrate Oracle datafiles to ASM storage via RMAN
How to Configure ASM disks using ASMLib or Raw Disks
How to migrate online redo logs to Oracle ASM storage
Migrate Oracle Flash Recovery Area to ASM storage via RMAN
Add ASM Instance into Enterprise Manager