centos7中udev 裸设备绑定问题

今天做测试增加了十一块盘做测试,记录下关于裸设备绑定的权限不对的问题

 

/usr/lib/udev/rules.d/60-raw.rules 问题如下:
重启系统后发现有raw10 和raw11权限变成了root


[root@rac1 ~]# ll /dev/raw total 0 crw-rw---- 1 grid asmadmin 162, 1 Dec 25 10:26 raw1 crw-rw---- 1 root disk 162, 10 Dec 25 10:26 raw10 crw-rw---- 1 root disk 162, 11 Dec 25 10:26 raw11 crw-rw---- 1 grid asmadmin 162, 2 Dec 25 10:26 raw2 crw-rw---- 1 grid asmadmin 162, 3 Dec 25 10:26 raw3 crw-rw---- 1 grid asmadmin 162, 4 Dec 25 10:26 raw4 crw-rw---- 1 grid asmadmin 162, 5 Dec 25 10:26 raw5 crw-rw---- 1 grid asmadmin 162, 6 Dec 25 10:26 raw6 crw-rw---- 1 grid asmadmin 162, 7 Dec 25 10:26 raw7 crw-rw---- 1 grid asmadmin 162, 8 Dec 25 10:26 raw8 crw-rw---- 1 grid asmadmin 162, 9 Dec 25 10:26 raw9 crw-rw---- 1 root disk 162, 0 Dec 25 10:26 rawctl [root@rac1 ~]# vi /usr/lib/udev/rules.d/60-raw.rules [root@rac1 ~]#


设备可以识别到

[root@rac1 ~]# 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 /dev/raw/raw4: bound to major 8, minor 65 /dev/raw/raw5: bound to major 8, minor 81 /dev/raw/raw6: bound to major 8, minor 97 /dev/raw/raw7: bound to major 8, minor 113 /dev/raw/raw8: bound to major 8, minor 129 /dev/raw/raw9: bound to major 8, minor 145 /dev/raw/raw10: bound to major 8, minor 161 /dev/raw/raw11: bound to major 8, minor 177


查看配置文件如下

[root@rac1 ~]# cat /usr/lib/udev/rules.d/60-raw.rules # # Enter raw device bindings here. # # An example would be: # ACTION=="add", KERNEL=="sda", RUN+="/usr/bin/raw /dev/raw/raw1 %N" # to bind /dev/raw/raw1 to /dev/sda, or # ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/usr/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=="sdc1", RUN+="/bin/raw /dev/raw/raw2 %N" ACTION=="add", KERNEL=="sdd1", RUN+="/bin/raw /dev/raw/raw3 %N" ACTION=="add", KERNEL=="sde1", RUN+="/bin/raw /dev/raw/raw4 %N" ACTION=="add", KERNEL=="sdf1", RUN+="/bin/raw /dev/raw/raw5 %N" ACTION=="add", KERNEL=="sdg1", RUN+="/bin/raw /dev/raw/raw6 %N" ACTION=="add", KERNEL=="sdh1", RUN+="/bin/raw /dev/raw/raw7 %N" ACTION=="add", KERNEL=="sdi1", RUN+="/bin/raw /dev/raw/raw8 %N" ACTION=="add", KERNEL=="sdj1", RUN+="/bin/raw /dev/raw/raw9 %N" ACTION=="add", KERNEL=="sdk1", RUN+="/bin/raw /dev/raw/raw10 %N" ACTION=="add", KERNEL=="sdl1", RUN+="/bin/raw /dev/raw/raw11 %N" KERNEL=="raw[1]", MODE="0660", OWNER="grid", GROUP="asmadmin" KERNEL=="raw[2]", MODE="0660", OWNER="grid", GROUP="asmadmin" KERNEL=="raw[3]", MODE="0660", OWNER="grid", GROUP="asmadmin" KERNEL=="raw[4]", MODE="0660", OWNER="grid", GROUP="asmadmin" KERNEL=="raw[5]", MODE="0660", OWNER="grid", GROUP="asmadmin" KERNEL=="raw[6]", MODE="0660", OWNER="grid", GROUP="asmadmin" KERNEL=="raw[7]", MODE="0660", OWNER="grid", GROUP="asmadmin" KERNEL=="raw[8]", MODE="0660", OWNER="grid", GROUP="asmadmin" KERNEL=="raw[9]", MODE="0660", OWNER="grid", GROUP="asmadmin" KERNEL=="raw[10]", MODE="0660", OWNER="grid", GROUP="asmadmin" KERNEL=="raw[11]", MODE="0660", OWNER="grid", GROUP="asmadmin"

 

 

解决办法增加配置

将原来的配置

KERNEL=="raw[10]", MODE="0660", OWNER="grid", GROUP="asmadmin"
KERNEL=="raw[11]", MODE="0660", OWNER="grid", GROUP="asmadmin"

  多半是raw设备超过10十块之后不支持raw[10]写法,所以换位*匹配

修改如下
KERNEL=="raw*", MODE="0660", OWNER="grid", GROUP="asmadmin"

  

 

重启后设备权限正常。

 

 

[root@rac1 ~]# ll /dev/raw
total 0
crw-rw---- 1 grid asmadmin 162,  1 Dec 25 10:35 raw1
crw-rw---- 1 grid asmadmin 162, 10 Dec 25 10:35 raw10
crw-rw---- 1 grid asmadmin 162, 11 Dec 25 10:35 raw11
crw-rw---- 1 grid asmadmin 162,  2 Dec 25 10:35 raw2
crw-rw---- 1 grid asmadmin 162,  3 Dec 25 10:35 raw3
crw-rw---- 1 grid asmadmin 162,  4 Dec 25 10:35 raw4
crw-rw---- 1 grid asmadmin 162,  5 Dec 25 10:35 raw5
crw-rw---- 1 grid asmadmin 162,  6 Dec 25 10:35 raw6
crw-rw---- 1 grid asmadmin 162,  7 Dec 25 10:35 raw7
crw-rw---- 1 grid asmadmin 162,  8 Dec 25 10:35 raw8
crw-rw---- 1 grid asmadmin 162,  9 Dec 25 10:35 raw9
crw-rw---- 1 grid asmadmin 162,  0 Dec 25 10:35 rawctl
[root@rac1 ~]# 

  

 

posted @ 2021-12-25 23:36  IT杂物铺  阅读(902)  评论(0编辑  收藏  举报