Redhat7 Udev繫結(DM multipath)多路徑裝置

531968912發表於2017-06-06


搞定RedHat7 Udev繫結多路徑裝置的問題,記錄下,方便大家使用


1) 取得DM_UUID:

cd /dev/mapper
for i in `ls mpath*`; do printf "%s %s\n" "$i" "$(udevadm info --query=all --name=/dev/mapper/$i |grep -i dm_uuid)"; done

LOG:
mpatha E: DM_UUID=mpath-14f504e46494c4552686a374a58592d763045432d5a305a6a
mpathb E: DM_UUID=mpath-14f504e46494c455267334f6f69422d6f51626c2d33516467
mpathc E: DM_UUID=mpath-14f504e46494c45527172433537322d476d47522d62757574
mpathd E: DM_UUID=mpath-14f504e46494c4552426f38676d392d626652342d6d6f7872
mpathe E: DM_UUID=mpath-14f504e46494c4552766d6e434c792d6a7065302d65346e70
mpathf E: DM_UUID=mpath-14f504e46494c45525a6c345564512d517274652d304e7a72

2) 生成rules檔案

vi /etc/udev/rules.d/99-oracle-asmdevices.rules

KERNEL=="dm-*",ENV{DM_UUID}=="mpath-14f504e46494c4552686a374a58592d763045432d5a305a6a",SYMLINK+="asm_test1",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-14f504e46494c455267334f6f69422d6f51626c2d33516467",SYMLINK+="asm_test2",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-14f504e46494c45527172433537322d476d47522d62757574",SYMLINK+="asm_test3",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-14f504e46494c4552426f38676d392d626652342d6d6f7872",SYMLINK+="asm_test4",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-14f504e46494c4552766d6e434c792d6a7065302d65346e70",SYMLINK+="asm_test5",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-14f504e46494c45525a6c345564512d517274652d304e7a72",SYMLINK+="asm_test6",OWNER="grid",GROUP="asmadmin",MODE="0660"

3) scp rules檔案至其他節點

scp /etc/udev/rules.d/99-oracle-asmdevices.rules node2:/etc/udev/rules.d/

4) 重新載入rules檔案

udevadm control --reload-rules
udevadm trigger

5) 檢視繫結後裝置資訊

[root@test1 rules.d]# ls -l /dev/asm*
lrwxrwxrwx 1 root root 4 Aug 20 14:42 /dev/asm_test1 -> dm-2
lrwxrwxrwx 1 root root 4 Aug 20 14:42 /dev/asm_test2 -> dm-3
lrwxrwxrwx 1 root root 4 Aug 20 14:42 /dev/asm_test3 -> dm-4
lrwxrwxrwx 1 root root 4 Aug 20 14:42 /dev/asm_test4 -> dm-5
lrwxrwxrwx 1 root root 4 Aug 20 14:42 /dev/asm_test5 -> dm-6
lrwxrwxrwx 1 root root 4 Aug 20 14:42 /dev/asm_test6 -> dm-7

[root@test1 rules.d]# ls -l /dev/dm-*
brw-rw---- 1 grid asmadmin 253, 2 Aug 20 14:42 /dev/dm-2
brw-rw---- 1 grid asmadmin 253, 3 Aug 20 14:42 /dev/dm-3
brw-rw---- 1 grid asmadmin 253, 4 Aug 20 14:42 /dev/dm-4
brw-rw---- 1 grid asmadmin 253, 5 Aug 20 14:42 /dev/dm-5
brw-rw---- 1 grid asmadmin 253, 6 Aug 20 14:42 /dev/dm-6
brw-rw---- 1 grid asmadmin 253, 7 Aug 20 14:42 /dev/dm-7


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25462274/viewspace-2140326/,如需轉載,請註明出處,否則將追究法律責任。

相關文章