RHEL5 rawdevice mapping

Setting a raw device in RedHat/CentOS 5 for Oracle RAC

Apparently the issue got changed since RedHat 4, which had /etc/sysconfig/rawdevices, /etc/init.d/raw & /usr/bin/raw.

This version introduces /etc/udev/rules.d/60-raw.rules & /bin/raw.

A. Doing it manually (example):

/bin/raw /dev/raw/raw1 /dev/sdb1

of course, it’ll be forgotten after reboot. so:

B. Doing it the right way – udev (example):

Add to /etc/udev/rules.d/60-raw.rules:

ACTION==”add”, KERNEL==”sdb1″, RUN+=”/bin/raw /dev/raw/raw1 %N”

[Optional] to set permissions, create a new /etc/udev/rules.d/99-raw-perms.rules containing lines such as:

KERNEL==”raw[1-2]”, MODE=”0640″, GROUP=”oinstall”, OWNER=”oracle”

The header of rules.d/60-raw.rules file mentions that this method of using raw devices is deprecated. But still, I think that’s the only available way if one wants to use raw devices with Oracle RAC, Either for cluster issues (Voting+OCR) or simple Oracle data files.

Issue:

How do I add raw device mapping in Red Hat Enterprise Linux 5?

Resolution:

The raw devices interface has been deprecated in Red Hat Enterprise Linux 5. It is now configured via udev rules.

To add raw device mapping, add entries to /etc/udev/rules.d/60-raw.rules in the following formats:

For device names:

ACTION==”add”, KERNEL==””, RUN+=”raw /dev/raw/rawX %N”

For major / minor numbers:

ACTION==”add”, ENV{MAJOR}=”A”, ENV{MINOR}=”B”, RUN+=”raw /dev/raw/rawX %M %m”

Replace with the name of the device needed to bind (such as /dev/sda1). “A” and “B” are the major / minor numbers of the device needed for binding, an “X” is the raw device number that the system wants to use.

If there is a large, pre-existing /etc/sysconfig/rawdevices file, convert it with the following script:

#!/bin/sh

grep -v “^ *#” /etc/sysconfig/rawdevices | grep -v “^$” | while read dev major

minor ; do

        if [ -z “$minor” ]; then

                echo “ACTION==\\”add\\”, KERNEL==\\”${major##/dev/}\\”,

RUN+=\\”/usr/bin/raw $dev %N\\””

        else

                echo “ACTION==\\”add\\”, ENV{MAJOR}==\\”$major\\”,

ENV{MINOR}==\\”$minor\\”, RUN+=\\”/usr/bin/raw $dev %M %m\\””

        fi

done

서진우

슈퍼컴퓨팅 전문 기업 클루닉스/ 상무(기술이사)/ 정보시스템감리사/ 시스존 블로그 운영자

You may also like...

페이스북/트위트/구글 계정으로 댓글 가능합니다.