Redhat7Udev如何绑定单路径设备

这篇文章主要介绍Redhat7 Udev如何绑定单路径设备,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

成都创新互联公司基于分布式IDC数据中心构建的平台为众多户提供服务器托管 四川大带宽租用 成都机柜租用 成都服务器租用。

1.取得磁盘UUID:

for disk in `ls /dev/sd*`
                  do
                    echo $disk
                    /usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=$disk
                  done
                  
                  
/dev/sdb
36000c29cffb16d0ab6e706d8474b8185
/dev/sdc
36000c294296b162323c3d18f218c8ebe
/dev/sdd
36000c293d28c648b8ea3780f31d3aebe
/dev/sde
36000c29fde25492009f3fe4882603755
/dev/sdf
36000c29845ce8733dcd8f3929da7b5cd
/dev/sdi
36000c2915522598d7dc3510d3b2f684c
/dev/sdj
36000c299864887911287c47884386547
/dev/sdk
36000c29d4618f7df9988b2b35a5519a1
/dev/sdl
36000c293efbdb7dcd808213db15a0113
/dev/sdm
36000c294c9da2b5885758cf6bcc3647a
/dev/sdn
36000c2905f57bc45665172b71346051e
/dev/sdo
36000c299475e8f0fdf40ad2606e78168
/dev/sdp
36000c293a88560cbd6232bc838960608

2.生成rules文件

cat /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd?", ENV{ID_SERIAL}=="36000c29cffb16d0ab6e706d8474b8185", SYMLINK+="asm_ocr_1_1",  OWNER="grid",  GROUP="asmadmin", MODE="0660"
KERNEL=="sd?", ENV{ID_SERIAL}=="36000c294296b162323c3d18f218c8ebe", SYMLINK+="asm_ocr_2_1",  OWNER="grid",  GROUP="asmadmin", MODE="0660"
KERNEL=="sd?", ENV{ID_SERIAL}=="36000c293d28c648b8ea3780f31d3aebe", SYMLINK+="asm_vote_1_1",  OWNER="grid",  GROUP="asmadmin", MODE="0660"
KERNEL=="sd?", ENV{ID_SERIAL}=="36000c29fde25492009f3fe4882603755", SYMLINK+="asm_vote_2_1",  OWNER="grid",  GROUP="asmadmin", MODE="0660"
KERNEL=="sd?", ENV{ID_SERIAL}=="36000c29845ce8733dcd8f3929da7b5cd", SYMLINK+="asm_vote_3_1",  OWNER="grid",  GROUP="asmadmin", MODE="0660"
KERNEL=="sd?", ENV{ID_SERIAL}=="36000c2915522598d7dc3510d3b2f684c", SYMLINK+="asm_data_1_1",  OWNER="grid",  GROUP="asmadmin", MODE="0660"
KERNEL=="sd?", ENV{ID_SERIAL}=="36000c299864887911287c47884386547", SYMLINK+="asm_data_1_2",  OWNER="grid",  GROUP="asmadmin", MODE="0660"
KERNEL=="sd?", ENV{ID_SERIAL}=="36000c29d4618f7df9988b2b35a5519a1", SYMLINK+="asm_data_1_3",  OWNER="grid",  GROUP="asmadmin", MODE="0660"
KERNEL=="sd?", ENV{ID_SERIAL}=="36000c293efbdb7dcd808213db15a0113", SYMLINK+="asm_data_2_1",  OWNER="grid",  GROUP="asmadmin", MODE="0660"
KERNEL=="sd?", ENV{ID_SERIAL}=="36000c294c9da2b5885758cf6bcc3647a", SYMLINK+="asm_data_2_2",  OWNER="grid",  GROUP="asmadmin", MODE="0660"
KERNEL=="sd?", ENV{ID_SERIAL}=="36000c2905f57bc45665172b71346051e", SYMLINK+="asm_data_2_3",  OWNER="grid",  GROUP="asmadmin", MODE="0660"
KERNEL=="sd?", ENV{ID_SERIAL}=="36000c299475e8f0fdf40ad2606e78168", SYMLINK+="asm_fra_1_1",  OWNER="grid",  GROUP="asmadmin", MODE="0660"
KERNEL=="sd?", ENV{ID_SERIAL}=="36000c293a88560cbd6232bc838960608", SYMLINK+="asm_fra_2_1",  OWNER="grid",  GROUP="asmadmin", MODE="0660"

3.加载rules文件

udevadm control --reload-rules
udevadm trigger

4.绑定后设备信息如下:

ls -l /dev/sd*

brw-rw---- 1 grid asmadmin  8,  16 Aug 29 09:28 /dev/sdb
brw-rw---- 1 grid asmadmin  8,  32 Aug 29 09:28 /dev/sdc
brw-rw---- 1 grid asmadmin  8,  48 Aug 29 09:28 /dev/sdd
brw-rw---- 1 grid asmadmin  8,  64 Aug 29 09:28 /dev/sde
brw-rw---- 1 grid asmadmin  8,  80 Aug 29 09:28 /dev/sdf
brw-rw---- 1 grid asmadmin  8, 128 Aug 29 09:28 /dev/sdi
brw-rw---- 1 grid asmadmin  8, 144 Aug 29 09:28 /dev/sdj
brw-rw---- 1 grid asmadmin  8, 160 Aug 29 09:27 /dev/sdk
brw-rw---- 1 grid asmadmin  8, 176 Aug 29 09:28 /dev/sdl
brw-rw---- 1 grid asmadmin  8, 192 Aug 29 09:27 /dev/sdm
brw-rw---- 1 grid asmadmin  8, 208 Aug 29 09:28 /dev/sdn
brw-rw---- 1 grid asmadmin  8, 224 Aug 29 09:28 /dev/sdo
brw-rw---- 1 grid asmadmin  8, 240 Aug 29 09:28 /dev/sdp


ls -l /dev/asm*

lrwxrwxrwx 1 root root 3 Aug 29 09:27 /dev/asm_data_1_1 -> sdi
lrwxrwxrwx 1 root root 3 Aug 29 09:27 /dev/asm_data_1_2 -> sdj
lrwxrwxrwx 1 root root 3 Aug 29 09:27 /dev/asm_data_1_3 -> sdk
lrwxrwxrwx 1 root root 3 Aug 29 09:27 /dev/asm_data_2_1 -> sdl
lrwxrwxrwx 1 root root 3 Aug 29 09:27 /dev/asm_data_2_2 -> sdm
lrwxrwxrwx 1 root root 3 Aug 29 09:27 /dev/asm_data_2_3 -> sdn
lrwxrwxrwx 1 root root 3 Aug 29 09:27 /dev/asm_fra_1_1 -> sdo
lrwxrwxrwx 1 root root 3 Aug 29 09:27 /dev/asm_fra_2_1 -> sdp
lrwxrwxrwx 1 root root 3 Aug 29 09:27 /dev/asm_ocr_1_1 -> sdb
lrwxrwxrwx 1 root root 3 Aug 29 09:27 /dev/asm_ocr_2_1 -> sdc
lrwxrwxrwx 1 root root 3 Aug 29 09:27 /dev/asm_vote_1_1 -> sdd
lrwxrwxrwx 1 root root 3 Aug 29 09:27 /dev/asm_vote_2_1 -> sde
lrwxrwxrwx 1 root root 3 Aug 29 09:27 /dev/asm_vote_3_1 -> sdf

以上是“Redhat7 Udev如何绑定单路径设备”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!


当前名称:Redhat7Udev如何绑定单路径设备
文章来源:http://hbruida.cn/article/pdesjg.html