使用UDEV绑定ASM多路径磁盘

时间:2022-02-25 19:14:23
OS版本:RHEL6.4
1) 找出目标磁盘的分区别名
# dmsetup ls |grep data
data01 (253:9)
data04 (253:4)
data03 (253:3)
data02 (253:2)
# dmsetup ls |grep crs
crs03 (253:8)
crs02 (253:7)
crs01 (253:5)

2) 编写/etc/udev/rules.d/12-dm-permissions.rules规则文件
ENV{DM_NAME}=="data01", OWNER:="oragrid", GROUP:="asmadmin", MODE:="660", SYMLINK+="iscsi/asm-$env{DM_NAME}"
ENV{DM_NAME}=="data02", OWNER:="oragrid", GROUP:="asmadmin", MODE:="660", SYMLINK+="iscsi/asm-$env{DM_NAME}"
ENV{DM_NAME}=="data03", OWNER:="oragrid", GROUP:="asmadmin", MODE:="660", SYMLINK+="iscsi/asm-$env{DM_NAME}"
ENV{DM_NAME}=="data04", OWNER:="oragrid", GROUP:="asmadmin", MODE:="660", SYMLINK+="iscsi/asm-$env{DM_NAME}"
ENV{DM_NAME}=="crs01", OWNER:="oragrid", GROUP:="asmadmin", MODE:="660", SYMLINK+="iscsi/asm-$env{DM_NAME}"
ENV{DM_NAME}=="crs02", OWNER:="oragrid", GROUP:="asmadmin", MODE:="660", SYMLINK+="iscsi/asm-$env{DM_NAME}"
ENV{DM_NAME}=="crs03", OWNER:="oragrid", GROUP:="asmadmin", MODE:="660", SYMLINK+="iscsi/asm-$env{DM_NAME}"

3) 重启多路径服务
# service multipathd restart

4) 检查权限是否设置正确
# ls -l /dev/dm*
brw-rw---- 1 root disk 253, 0 Dec 15 14:18 /dev/dm-0
brw-rw---- 1 root disk 253, 1 Dec 15 14:18 /dev/dm-1
brw-rw---- 1 root disk 253, 10 Dec 15 14:18 /dev/dm-10
brw-rw---- 1 oragrid asmadmin 253, 2 Dec 15 14:18 /dev/dm-2
brw-rw---- 1 oragrid asmadmin 253, 3 Dec 15 14:18 /dev/dm-3
brw-rw---- 1 oragrid asmadmin 253, 4 Dec 15 14:18 /dev/dm-4
brw-rw---- 1 oragrid asmadmin 253, 5 Dec 15 14:18 /dev/dm-5
brw-rw---- 1 oragrid asmadmin 253, 7 Dec 15 14:18 /dev/dm-7
brw-rw---- 1 oragrid asmadmin 253, 8 Dec 15 14:18 /dev/dm-8
brw-rw---- 1 oragrid asmadmin 253, 9 Dec 15 14:18 /dev/dm-9


5) 确保多路径设备的ASM符号链接已经存在# ls -l /dev/iscsi/*
[root@ysdb1 ~]# ls -l /dev/iscsi/*
lrwxrwxrwx 1 root root 7 Dec 15 14:18 /dev/asm/asm-crs01 -> ../dm-5
lrwxrwxrwx 1 root root 7 Dec 15 14:18 /dev/asm/asm-crs02 -> ../dm-7
lrwxrwxrwx 1 root root 7 Dec 15 14:18 /dev/asm/asm-crs03 -> ../dm-8
lrwxrwxrwx 1 root root 7 Dec 15 14:18 /dev/asm/asm-data01 -> ../dm-9
lrwxrwxrwx 1 root root 7 Dec 15 14:18 /dev/asm/asm-data02 -> ../dm-2
lrwxrwxrwx 1 root root 7 Dec 15 14:18 /dev/asm/asm-data03 -> ../dm-3
lrwxrwxrwx 1 root root 7 Dec 15 14:18 /dev/asm/asm-data04 -> ../dm-4