在以前的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文件,添加最后的两行测试:
[root@ ~]# 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"
[root@ ~]#
重启系统后查看raw设备:
[root@ ~]# raw -aq
/dev/raw/raw11: bound to major 8, minor 9
/dev/raw/raw12: bound to major 8, minor 10
[root@ ~]#
------------------------------------------------------------------------------
在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