ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Redhat7 Udev绑定单路径设备方法

Redhat7 Udev绑定单路径设备方法

Linux操作系统 作者:lovestanford 时间:2017-01-04 11:40:26 0 删除 编辑
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






来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21754115/viewspace-2131866/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2012-09-27

  • 博文量
    213
  • 访问量
    974565