裸设备经常用于Oracle等数据库系统存放数据,过去,在DC Server 5.0是使用rawdevices服务,配合raw命令来实现物理设备和裸设备的绑定工作的,但从Asianux 3.0开始,已经改用udev来管理大部分的物理设备,因此,裸设备的绑定方法也需要修改。
一、DC Server 5.0 版本
DC Server 5.0使用rawdevices服务管理裸设备:
引用
# chkconfig –list|grep raw
rawdevices 0:关闭 1:关闭 2:关闭 3:启用 4:启用 5:启用 6:关闭
rawdevices 0:关闭 1:关闭 2:关闭 3:启用 4:启用 5:启用 6:关闭
配置文件在/etc/sysconfig/rawdevices:
引用
# cd /etc/sysconfig
# cat rawdevices
# This file and interface are deprecated.
# Applications needing raw device access should open regular
# block devices with O_DIRECT.
# raw device bindings
# format:
#
# example: /dev/raw/raw1 /dev/sda1
# /dev/raw/raw2 8 5
# cat rawdevices
# This file and interface are deprecated.
# Applications needing raw device access should open regular
# block devices with O_DIRECT.
# raw device bindings
# format:
#
# example: /dev/raw/raw1 /dev/sda1
# /dev/raw/raw2 8 5
显而易见,只要在该配置文件中加入类似:
引用
/dev/raw/raw1 /dev/sda1
即可。
二、Asianux 3.0 版本
该版本改用udev管理物理设备,配置文件在/etc/udev/rules.d/60-raw.rules:
引用
# cat 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.
# 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==”sda1″, RUN+=”/bin/raw /dev/raw/raw1 %N”
ACTION==”add”, KERNEL==”raw1″, OWNER==”oracle”,GROUP==”oinstall”,MODE==”0640″
ACTION==”add”, KERNEL==”raw1″, OWNER==”oracle”,GROUP==”oinstall”,MODE==”0640″
第二行的参数可用于设置裸设备的用户宿主和权限。
示例配置文件:
下载文件
点击这里下载文件
本文参考zzniu#redflag-linux.com提供的文档实际操作后编写而成。
原创文章,作者:kepupublish,如若转载,请注明出处:https://blog.ytso.com/105364.html