您好,登錄后才能下訂單哦!
今天就跟大家聊聊有關linux udev的配置是什么,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結了以下內容,希望大家根據這篇文章可以有所收獲。
1.查詢DISK uuid
# /usr/lib/udev/scsi_id -g -u /dev/sdb
獲取需要綁定ASM Disk磁盤的uuid
for i in b c d e f g;
do
echo "sd$i" "`/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`";
done
2.編輯udev rule文件
(1).Create UDEV Permission Rule Prior Up-To Version 11.1.0.7
# /bin/cat /etc/udev/rules.d/99-raw.rules
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/%P", RESULT=="3600805f30016c0e0ad41ffa8e6d90001", NAME="raw1", ACTION=="add|change",OWNER="root", GROUP="oinstall", MODE="0640"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/%P", RESULT=="3600805f30016c0e0ae51efbfb2930002", NAME="raw2", ACTION=="add|change",OWNER="oracle", GROUP="oinstall", MODE="0660"
(2).Create UDEV Permission Rule For Version 11.2 And Later
For RHEL5/OL5/OL5
# /bin/cat /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/%P", RESULT=="350002ac000010b52", NAME="vote1", ACTION=="add|change", OWNER="grid",GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/%P", RESULT=="350002ac000020b52", NAME="vote2", ACTION=="add|change", OWNER="grid",GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/%P", RESULT=="350002ac000030b52", NAME="vote3", ACTION=="add|change", OWNER="grid",GROUP="asmadmin", MODE="0660"
For RHEL6/OL6
# /bin/cat /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id i --whitelisted --device=/dev/$name", RESULT=="350002ac000010b52", NAME="vote1", ACTION=="add|change", OWNER="grid",GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id i --whitelisted --device=/dev/$name", RESULT=="350002ac000020b52", NAME="vote2", ACTION=="add|change", OWNER="grid",GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id i --whitelisted --device=/dev/$name", RESULT=="350002ac000030b52", NAME="vote3", ACTION=="add|change", OWNER="grid",GROUP="asmadmin", MODE="0660"
For RHEL7
# /bin/cat /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="1IET_00020002", RUN+="/bin/sh -c 'mknod /dev/asmdisk01p1 b $major $minor; chown grid:dba /dev/asmdisk01p1; chmod 0660 /dev/asmdisk01p1'"
快速生成腳本:
redhat 6
for i in b c d e f g;
do
echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\", RESULT==\"`/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\""
done
redhat 7
for i in b c d e f g;
do
echo "KERNEL==\"sd*\", ENV{DEVTYPE}==\"disk\", SUBSYSTEM==\"block\", PROGRAM==\"/usr/lib/udev/scsi_id -g -u -d \$devnode\", RESULT==\"`/usr/lib/udev/scsi_id -g -u /dev/sd$i`\", RUN+=\"/bin/sh -c 'mknod /dev/asmdisk$i b \$major \$minor; chown grid:asmadmin /dev/asmdisk$i; chmod 0660 /dev/asmdisk$i'\""
done
3.重啟UDEV使配置生效
On RHEL5/OL5:
# /sbin/udevcontrol reload_rules
# /sbin/start_udev
On RHEL6/OL6:
#/sbin/udevadm control --reload-rules
#/sbin/start_udev
On RHEL7:
-Check for new device name:
# /sbin/udevadm trigger --type=devices --action=change
# /bin/ls /dev/asmdisk01p1
-To reload udev rule execute below command:
# /sbin/udevadm control --reload
-For Troubleshooting udev rule execute below command:
# /sbin/udevadm test /sys/block/sdb
看完上述內容,你們對linux udev的配置是什么有進一步的了解嗎?如果還想了解更多知識或者相關內容,請關注億速云行業資訊頻道,感謝大家的支持。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。