在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@node1 ~]# 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=="sdb1",RUN+="/bin/raw /dev/raw/raw1 %N"
- ACTION=="add",KERNEL=="sdb2",RUN+="/bin/raw /dev/raw/raw2 %N"
- ACTION=="add",KERNEL=="sdb3",RUN+="/bin/raw /dev/raw/raw3 %N"
- ACTION=="add",KERNEL=="sdb4",RUN+="/bin/raw /dev/raw/raw4 %N"
- KERNEL=="raw[1-4]", OWNER="oracle", GROUP="oinstall", MODE="640"
- [root@node1 ~]#
重启下服务:
- [root@node1 ~]# start_udev
- Starting udev: [ OK ]
验证一下
- [root@node1 ~]# ls /dev/raw/ -l
- total 0
- crw-r----- 1 oracle oinstall 162, 1 Jun 6 17:57 raw1
- crw-r----- 1 oracle oinstall 162, 2 Jun 6 17:57 raw2
- crw-r----- 1 oracle oinstall 162, 3 Jun 6 17:57 raw3
- crw-r----- 1 oracle oinstall 162, 4 Jun 6 17:57 raw4
本文转自 hsbxxl 51CTO博客,原文链接:http://blog.51cto.com/hsbxxl/771885,如需转载请自行联系原作者