如何进行Centos7 multipath 盘权限绑定.,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。
Centos7 multipath 盘权限绑定.
[root@centos7 ~]$ more /etc/udev/rules.d/99-oracle.rules
KERNEL=="dm-0",OWNER="oragrid",GROUP="dba",MODE="0660"
KERNEL=="dm-1",OWNER="oragrid",GROUP="dba",MODE="0660"
KERNEL=="dm-2",OWNER="oragrid",GROUP="dba",MODE="0660"
KERNEL=="dm-3",OWNER="oragrid",GROUP="dba",MODE="0660"
KERNEL=="dm-4",OWNER="oragrid",GROUP="dba",MODE="0660"
KERNEL=="dm-5",OWNER="oragrid",GROUP="dba",MODE="0660"
KERNEL=="dm-6",OWNER="oragrid",GROUP="dba",MODE="0660"
KERNEL=="dm-7",OWNER="oragrid",GROUP="dba",MODE="0660"
KERNEL=="dm-8",OWNER="oragrid",GROUP="dba",MODE="0660"
KERNEL=="dm-9",OWNER="oragrid",GROUP="dba",MODE="0660"
关机前的对应关系
[root@centos7 ~]$ ls -l /dev/mapper/
total 0
crw——-. 1 root root 10, 236 Jan 26 12:18 control
lrwxrwxrwx. 1 root root 7 Jan 29 08:06 data01 -> ../dm-3
lrwxrwxrwx. 1 root root 7 Jan 29 08:06 data02 -> ../dm-0
lrwxrwxrwx. 1 root root 7 Jan 26 11:35 data03 -> ../dm-1
lrwxrwxrwx. 1 root root 7 Jan 29 08:06 data04 -> ../dm-4
lrwxrwxrwx. 1 root root 7 Jan 29 08:06 fra01 -> ../dm-5
lrwxrwxrwx. 1 root root 7 Jan 26 11:35 fra02 -> ../dm-6
lrwxrwxrwx. 1 root root 7 Jan 26 11:35 ocr01 -> ../dm-8
lrwxrwxrwx. 1 root root 7 Jan 26 11:35 ocr02 -> ../dm-7
lrwxrwxrwx. 1 root root 7 Jan 26 11:35 ocr03 -> ../dm-9
lrwxrwxrwx. 1 root root 8 Jan 26 12:18 ocr04 -> ../dm-10
lrwxrwxrwx. 1 root root 7 Jan 26 11:35 virtual -> ../dm-2
lrwxrwxrwx. 1 root root 8 Jan 26 12:18 virtual1 -> ../dm-11
重启后.对应关系发生了变化。如下:
data01重启是都要dm-3,重启后是dm-2
[root@centos7 ~]$ ls -l /dev/mapper/
total 0
crw——-. 1 root root 10, 236 Jan 29 2018 control
lrwxrwxrwx. 1 root root 7 Jan 29 2018 data01 -> ../dm-2
lrwxrwxrwx. 1 root root 7 Jan 29 2018 data02 -> ../dm-4
lrwxrwxrwx. 1 root root 7 Jan 29 2018 data03 -> ../dm-5
lrwxrwxrwx. 1 root root 7 Jan 29 2018 data04 -> ../dm-7
lrwxrwxrwx. 1 root root 7 Jan 29 2018 fra01 -> ../dm-3
lrwxrwxrwx. 1 root root 7 Jan 29 2018 fra02 -> ../dm-0
lrwxrwxrwx. 1 root root 7 Jan 29 2018 ocr01 -> ../dm-1
lrwxrwxrwx. 1 root root 7 Jan 29 2018 ocr02 -> ../dm-8
lrwxrwxrwx. 1 root root 8 Jan 29 2018 ocr03 -> ../dm-10
lrwxrwxrwx. 1 root root 7 Jan 29 2018 ocr04 -> ../dm-9
lrwxrwxrwx. 1 root root 7 Jan 29 2018 virtual -> ../dm-6
lrwxrwxrwx. 1 root root 8 Jan 29 2018 virtual1 -> ../dm-11
所以 KERNEL=="dm-0",OWNER="oragrid",GROUP="dba",MODE="0660"
这种绑定权限的方式有问题。
如果恰好没有绑定到…权限则不能正常赋予了。
采用如下方式,绑定权限。
[root@centos7 /etc/udev/rules.d]$ more 99-oracle.rules
PROGRAM="/usr/bin/chown oragrid:dba /dev/mapper/ocr01"
PROGRAM="/usr/bin/chown oragrid:dba /dev/mapper/ocr02"
PROGRAM="/usr/bin/chown oragrid:dba /dev/mapper/ocr03"
PROGRAM="/usr/bin/chown oragrid:dba /dev/mapper/ocr04"
PROGRAM="/usr/bin/chown oragrid:dba /dev/mapper/data01"
PROGRAM="/usr/bin/chown oragrid:dba /dev/mapper/data02"
PROGRAM="/usr/bin/chown oragrid:dba /dev/mapper/data03"
PROGRAM="/usr/bin/chown oragrid:dba /dev/mapper/data04"
PROGRAM="/usr/bin/chown oragrid:dba /dev/mapper/fra01"
PROGRAM="/usr/bin/chown oragrid:dba /dev/mapper/fra02"
PROGRAM="/usr/bin/chmod 0660 /dev/mapper/ocr01"
PROGRAM="/usr/bin/chmod 0660 /dev/mapper/ocr02"
PROGRAM="/usr/bin/chmod 0660 /dev/mapper/ocr03"
PROGRAM="/usr/bin/chmod 0660 /dev/mapper/ocr04"
PROGRAM="/usr/bin/chmod 0660 /dev/mapper/data01"
PROGRAM="/usr/bin/chmod 0660 /dev/mapper/data02"
PROGRAM="/usr/bin/chmod 0660 /dev/mapper/data03"
PROGRAM="/usr/bin/chmod 0660 /dev/mapper/data04"
PROGRAM="/usr/bin/chmod 0660 /dev/mapper/fra01"
PROGRAM="/usr/bin/chmod 0660 /dev/mapper/fra02"
重启后查看权限,给ASM用的盘的权限正常。
[root@centos7 /etc/udev/rules.d]$ ls -l /dev/mapper/
total 0
crw——-. 1 root root 10, 236 Jan 29 2018 control
lrwxrwxrwx. 1 root root 7 Jan 29 09:47 data01 -> ../dm-3
lrwxrwxrwx. 1 root root 7 Jan 29 09:47 data02 -> ../dm-5
lrwxrwxrwx. 1 root root 7 Jan 29 09:41 data03 -> ../dm-4
lrwxrwxrwx. 1 root root 7 Jan 29 09:47 data04 -> ../dm-2
lrwxrwxrwx. 1 root root 7 Jan 29 09:47 fra01 -> ../dm-6
lrwxrwxrwx. 1 root root 7 Jan 29 09:41 fra02 -> ../dm-0
lrwxrwxrwx. 1 root root 7 Jan 29 09:41 ocr01 -> ../dm-7
lrwxrwxrwx. 1 root root 7 Jan 29 09:41 ocr02 -> ../dm-8
lrwxrwxrwx. 1 root root 8 Jan 29 09:41 ocr03 -> ../dm-10
lrwxrwxrwx. 1 root root 7 Jan 29 09:41 ocr04 -> ../dm-9
lrwxrwxrwx. 1 root root 7 Jan 29 2018 virtual -> ../dm-1
lrwxrwxrwx. 1 root root 8 Jan 29 2018 virtual1 -> ../dm-11
[root@centos7 /etc/udev/rules.d]$ ls -l /dev/dm*
brw-rw—-. 1 oragrid dba 253, 0 Jan 29 09:41 /dev/dm-0
brw-rw—-. 1 root disk 253, 1 Jan 29 2018 /dev/dm-1
brw-rw—-. 1 oragrid dba 253, 10 Jan 29 09:41 /dev/dm-10
brw-rw—-. 1 root disk 253, 11 Jan 29 2018 /dev/dm-11
brw-rw—-. 1 oragrid dba 253, 2 Jan 29 09:47 /dev/dm-2
brw-rw—-. 1 oragrid dba 253, 3 Jan 29 09:51 /dev/dm-3
brw-rw—-. 1 oragrid dba 253, 4 Jan 29 09:41 /dev/dm-4
brw-rw—-. 1 oragrid dba 253, 5 Jan 29 09:51 /dev/dm-5
brw-rw—-. 1 oragrid dba 253, 6 Jan 29 09:51 /dev/dm-6
brw-rw—-. 1 oragrid dba 253, 7 Jan 29 09:51 /dev/dm-7
brw-rw—-. 1 oragrid dba 253, 8 Jan 29 09:51 /dev/dm-8
brw-rw—-. 1 oragrid dba 253, 9 Jan 29 09:41 /dev/dm-9
chown,chmod加上命令的全路径。
关于如何进行Centos7 multipath 盘权限绑定.问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注亿速云行业资讯频道了解更多相关知识。
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/200146.html