在以前的RedHat版本中,系統通過/etc/sysconfig/rawdevices配置raw的控制文件,通過/etc/init.d/rawdevices來管理raw設備的啟動和關閉。
在redhat5中,raw文件的位置已經改變成/bin/raw,系統裡面已經不存在/etc/sysconfig/rawdevices和/etc/init.d/rawdevices文件了,可以通過如下方法來管理raw文件。
1,建立/etc/sysconfig/rawdevices文件,然後從其他操作系統上拷貝/etc/init.d/rawdevices到本地機,修改 /etc/init.d/rawdevices文件中raw命令的具體位置,然後就可以通過/etc/init.d/rawdevices來啟動和關閉 raw文件了。
2,上面的方法是redhat以前的raw管理的方法,雖然這樣可以管理raw,但是畢竟不是太正規,redhat5正規的方法是通過udev來管理raw.
修改/etc/udev/rules.d/60-raw.rules文件,添加最後的兩行測試:
[[email protected] ~]# cat /etc/udev/rules.d/60-raw.rules
# This file and interface are deprecated.
# Applications needing raw device access should open regular
# block devices with O_DIRECT.
#
# Enter raw device bindings here.
#
# An example would be:
# ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
# ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.
ACTION=="add",KERNEL=="sda9",RUN+="/bin/raw /dev/raw/raw11 %N"
ACTION=="add",KERNEL=="sda10",RUN+="/bin/raw /dev/raw/raw12 %N"
[[email protected] ~]#
重啟系統後查看raw設備:
[[email protected] ~]# raw -aq
/dev/raw/raw11: bound to major 8, minor 9
/dev/raw/raw12: bound to major 8, minor 10
[[email protected] ~]#
------------------------------------------------------------------------------
在CentOS5.1中,問題:
[root@localhost sysconfig]# /sbin/service rawdevices restart
rawdevices: unrecognized service
-----------------------------------------------------------------------------
相關解釋:
Be aware that raw device technology had been deprecated in RedHat Linux 5 (RHEL5) and Oracle Enterprise Linux 5 OEL5). / Linux Kernel 2.6
Does this mean we cannot use Rawdevices in RHEL5 or OEL5? As always there’s a workaround to make this happen by means of UDEV technique and Oracle 11g & 10gR2 has options to configure components to access the block devices directly instead of rawdevices.Before we jump into the workaround, let see what exactly is missing at the O/S level w.r.to rawdevices in RHEL5 and OEL5,
/etc/sysconfig/rawdevices file doesn’t exist
/dev/raw doesn’t exist.
Service by the name “rawdevices” doesn’t exist.
Trying to run the command “service rawdevices restart” will result in “rawdevices: unrecognized service”.
Now lets see an example of configuring rawdevices in RHEL4 and RHEL5.
RHEL4
To map a rawdevice to a block device /dev/sdf1
Step 1: Make an entry in /etc/sysconfig/rawdevices file
/dev/raw/raw1 /dev/sdf1
Step 2: For the mapping to have immediate effect, restart the rawdevices service.
$>service rawdevices restart
Step 3: Change ownership to oracle user
$>chown oracle:dba /dev/raw/raw1
RHEL5 / OEL5
Step 1: Make an entry in /etc/udev/rules.d/60-raw.rules or create your own file viz., /etc/udev/rules.d/<any_no_above_60>-oracle-raw.rules (eg. 63-oracle-raw.rules)
ACTION==”add”, KERNEL==”sdf1″, RUN+=”/bin/raw /dev/raw/raw1 %N”
Step 2: For the mapping to have immediate effect, run below command
$>/bin/raw /dev/raw/raw1 /dev/sdf1
So if you or your system administrator have plans to upgrade an existing release of RHEL or OEL to RHEL5 / OEL5 or planning to perform a new installation of RAC on RHEL5 / OEL5, wherein rawdevices will be / are used, please do take additional care.
For more information you can refer to following
Metalink notes
RAC FAQ: 220970.1 (look for “What storage option should I use for RAC 10g on Linux? ASM / OCFS / Raw Devices / Block Devices / Ext3 ?”)
How to map raw device on RHEL5 and OEL5 – Note 443996.1
Linux 2.6 Kernel Deprecation Of Raw Devices – Note:357492.1
How to install Oracle Clusterware with shared storage on block devices – Note:401132.1