环境:
OS:Red Hat Linux As 5
在Linux As 5下安装裸设备需要编辑文件/etc/udev/rules.d/60-raw.rules.
1.添加硬盘分区sdb1,sdc1,sdd1(具体步骤省略)
2.编辑/etc/udev/rules.d/60-raw.rules添加如下内容
ACTION=="add", KERNEL=="sdb1",RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdc1",RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="sdd1",RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="sdc1",RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="sdd1",RUN+="/bin/raw /dev/raw/raw3 %N"
设置权限需要添加如下内容
KERNEL=="raw[1-3]*", NAME="raw/%k" OWNER="oracle" GROUP="oinstall", MODE="0660"
3.启动
[root@hxl oracle]# start_udev
Starting udev: [ OK ]
Starting udev: [ OK ]
4.查看当前的裸设备raw -qa 或者 ls -lrt /dev/raw/
[root@hxl oracle]# raw -qa
/dev/raw/raw1: bound to major 8, minor 17
/dev/raw/raw2: bound to major 8, minor 33
/dev/raw/raw3: bound to major 8, minor 49
这里的17 33 49 分别对应如下的输出,也就是裸设备跟硬盘分区的绑定关系
/dev/raw/raw1: bound to major 8, minor 17
/dev/raw/raw2: bound to major 8, minor 33
/dev/raw/raw3: bound to major 8, minor 49
这里的17 33 49 分别对应如下的输出,也就是裸设备跟硬盘分区的绑定关系
[root@hxl oracle]# ll /dev/sd[bcd]1
brw-r----- 1 root disk 8, 17 Jun 30 15:18 /dev/sdb1
brw-r----- 1 root disk 8, 33 Jun 30 15:18 /dev/sdc1
brw-r----- 1 root disk 8, 49 Jun 30 15:11 /dev/sdd1
brw-r----- 1 root disk 8, 17 Jun 30 15:18 /dev/sdb1
brw-r----- 1 root disk 8, 33 Jun 30 15:18 /dev/sdc1
brw-r----- 1 root disk 8, 49 Jun 30 15:11 /dev/sdd1
5.取消映射
raw /dev/raw/rawX 0 0
raw /dev/raw/rawX 0 0
-- The End --