redhat 5下管理 rawdevices
在以前的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@tonykorn97 ~]# 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@tonykorn97 ~]#
重启系统后查看raw设备:
[root@tonykorn97 ~]# raw -aq
/dev/raw/raw11: bound to major 8, minor 9
/dev/raw/raw12: bound to major 8, minor 10
[root@tonykorn97 ~]#