[root@ith1 ~]# ls -l /dev/disk/by-id/
total 0
lrwxrwxrwx. 1 root root 10 Jun 15 2017 dm-name-VolGroup-LogVol01 -> ../../dm-0
lrwxrwxrwx. 1 root root 10 Jun 15 2017 dm-name-VolGroup-LogVol02 -> ../../dm-1
lrwxrwxrwx. 1 root root 10 Jun 15 2017 dm-uuid-LVM-Ze9sFyl6VNaJeRBlqNU4s2QfskUtejKzjEU6lWVflh9ORdu8ZIzP6HGnUKTSu0df -> ../../dm-0
lrwxrwxrwx. 1 root root 10 Jun 15 2017 dm-uuid-LVM-Ze9sFyl6VNaJeRBlqNU4s2QfskUtejKzjuXYYcGunOw3knLdzps19qOsFdKnBvZ0 -> ../../dm-1
lrwxrwxrwx. 1 root root 9 Jun 15 2017 scsi-3600508b1001c0a60711d481f002c219f -> ../../sda
lrwxrwxrwx. 1 root root 10 Jun 15 2017 scsi-3600508b1001c0a60711d481f002c219f-part1 -> ../../sda1
lrwxrwxrwx. 1 root root 10 Jun 15 2017 scsi-3600508b1001c0a60711d481f002c219f-part2 -> ../../sda2
lrwxrwxrwx. 1 root root 9 Jun 15 2017 scsi-367ca23e100f08d9eae72e60300000036 -> ../../sdb
lrwxrwxrwx. 1 root root 9 Jun 15 2017 scsi-367ca23e100f08d9eae72fa0700000037 -> ../../sdc
lrwxrwxrwx. 1 root root 9 Jun 15 2017 scsi-367ca23e100f08d9eae73147200000038 -> ../../sdd
lrwxrwxrwx. 1 root root 9 Jun 15 2017 scsi-367ca23e100f08d9eae73289c00000039 -> ../../sde
lrwxrwxrwx. 1 root root 9 Jun 15 2017 wwn-0x600508b1001c0a60711d481f002c219f -> ../../sda
lrwxrwxrwx. 1 root root 10 Jun 15 2017 wwn-0x600508b1001c0a60711d481f002c219f-part1 -> ../../sda1
lrwxrwxrwx. 1 root root 10 Jun 15 2017 wwn-0x600508b1001c0a60711d481f002c219f-part2 -> ../../sda2
lrwxrwxrwx. 1 root root 9 Jun 15 2017 wwn-0x67ca23e100f08d9eae72e60300000036 -> ../../sdb
lrwxrwxrwx. 1 root root 9 Jun 15 2017 wwn-0x67ca23e100f08d9eae72fa0700000037 -> ../../sdc
lrwxrwxrwx. 1 root root 9 Jun 15 2017 wwn-0x67ca23e100f08d9eae73147200000038 -> ../../sdd
lrwxrwxrwx. 1 root root 9 Jun 15 2017 wwn-0x67ca23e100f08d9eae73289c00000039 -> ../../sde
[root@ith1 ~]# cat /etc/udev/rules.d/99-oracle-asmdisk.rules
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/lib/udev/scsi_id -g -u /dev/$name",RESULT=="367ca23e100f08d9eae72e60300000036", NAME="asm_disk1", OWNER="grid",GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/lib/udev/scsi_id -g -u /dev/$name",RESULT=="367ca23e100f08d9eae72fa0700000037", NAME="asm_disk2", OWNER="grid",GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/lib/udev/scsi_id -g -u /dev/$name",RESULT=="367ca23e100f08d9eae73147200000038", NAME="asm_disk3", OWNER="grid",GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/lib/udev/scsi_id -g -u /dev/$name",RESULT=="367ca23e100f08d9eae73289c00000039", NAME="asm_disk4", OWNER="grid",GROUP="asmadmin", MODE="0660"
或者使用自动定义盘符,因为在 /etc/multipath/bindings文件有固定的格式
KERNEL=="sd", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u /dev/$name", RESULT=="360002ac0000000000000001f00012e06", NAME="asmdiskb", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u /dev/$name", RESULT=="360002ac0000000000000002000012e06", NAME="asmdiskc", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u /dev/$name", RESULT=="360002ac0000000000000002100012e06", NAME="asmdiskd", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u /dev/$name", RESULT=="360002ac0000000000000002200012e06", NAME="asmdiske", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u /dev/$name", RESULT=="360002ac0000000000000002300012e06", NAME="asmdiskf", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u /dev/$name", RESULT=="360002ac0000000000000002500012e06", NAME="asmdiskg", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u /dev/$name", RESULT=="360002ac0000000000000002600012e06", NAME="asmdiskh", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u /dev/$name", RESULT=="360002ac0000000000000002700012e06", NAME="asmdiski", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u /dev/$name", RESULT=="360002ac0000000000000002800012e06", NAME="asmdiskj", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u /dev/$name", RESULT=="360002ac0000000000000002900012e06", NAME="asmdiskk", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u /dev/$name", RESULT=="360002ac0000000000000002a00012e06", NAME="asmdiskl", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u /dev/$name", RESULT=="360002ac0000000000000002b00012e06", NAME="asmdiskm", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u /dev/$name", RESULT=="360002ac0000000000000002c00012e06", NAME="asmdiskn", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u /dev/$name", RESULT=="360002ac0000000000000002d00012e06", NAME="asmdisko", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u /dev/$name", RESULT=="360002ac0000000000000002e00012e06", NAME="asmdiskp", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u /dev/$name", RESULT=="360002ac0000000000000002f00012e06", NAME="asmdiskq", OWNER="grid", GROUP="asmadmin", MODE="0660"
需要执行:
重启后,如果fdisk 看不到盘符,就执行start_udev后 然后multipat -v2 然后fdisk -l就看到了
方法二:
先在一个配置文件中指定一个wwid和多路径盘符一致的文件(如/etc/multipath/bindings 格式为:盘符 wwid
[root@ith1 ~]# cat /etc/multipath/bindings
# Multipath bindings, Version : 1.0
# NOTE: this file is automatically maintained by the multipath program.
# You should not need to edit this file in normal circumstances.
#
# Format:
# alias wwid
#
spathap1 367ca23e100f08d9eae72e60300000036
spathap2 367ca23e100f08d9eae72fa0700000037
spathap3 367ca23e100f08d9eae73147200000038
spathap4 367ca23e100f08d9eae73289c00000039
spathap5 367ca23e100f08d9eae72e60300000040
spathap6 367ca23e100f08d9eae72fa0700000041
spathap7 367ca23e100f08d9eae73147200000042
之后根据命名的盘符修改权限。
cd /lib/udev/rules.d
ll 99-oracle-permission.rules
vi 99-oracle-permission.rules
SUBSYSTEM!="block", GOTO="dm_end"
KERNEL!="dm-*", GOTO="dm_end"
PROGRAM=="/bin/bash -c '/sbin/dmsetup info -c --noheadings -j %M -m %m -o name'"
RESULT=="spathap1", OWNER:="grid",GROUP:="asmadmin",MODE:="660"
RESULT=="spathap2", OWNER:="grid",GROUP:="asmadmin",MODE:="660"
RESULT=="spathap3", OWNER:="grid",GROUP:="asmadmin",MODE:="660"
RESULT=="spathap4", OWNER:="grid",GROUP:="asmadmin",MODE:="660"
RESULT=="spathap5", OWNER:="grid",GROUP:="asmadmin",MODE:="660"
RESULT=="spathap6", OWNER:="grid",GROUP:="asmadmin",MODE:="660"
RESULT=="spathap7", OWNER:="grid",GROUP:="asmadmin",MODE:="660"
LABEL="dm_end"
说明:
1) oracle11 为 oracle 账户,oinstall 为 oracle 账户所在组,spathdm
为 oracle lv 所在多路径设备,现网可根据实际情况修改。
2) 如果 oracle 安装在多路径分区设备上,规则文件中可增加配置如下:
RESULT==" spatheqp1", OWNER:=" oracle11",GROUP:=" oinstall
",MODE:="660"
3) 如果 oracle 安装在 lv 上,规则文件中可增加配置如下:
RESULT==" vgtest-lvdata", OWNER:="oracle11",GROUP:=" oinstall
",MODE:="660"
重载udev规则
/sbin/udevadm control --reload-rules
检查
操作成功后,检查如下:
[root@hisrac1 ~]# ll /dev/dm*
brw-rw----. 1 root disk 253, 0 Dec 1 20:15 /dev/dm-0
brw-rw----. 1 root disk 253, 1 Dec 1 20:15 /dev/dm-1
brw-rw----. 1 root disk 253, 10 Dec 1 20:15 /dev/dm-10
brw-rw----. 1 root disk 253, 2 Dec 1 20:15 /dev/dm-2
brw-rw----. 1 grid asmadmin 253, 3 Dec 23 15:21 /dev/dm-3
brw-rw----. 1 grid asmadmin 253, 4 Dec 23 15:21 /dev/dm-4
brw-rw----. 1 grid asmadmin 253, 5 Dec 23 15:21 /dev/dm-5
brw-rw----. 1 grid asmadmin 253, 6 Dec 23 15:21 /dev/dm-6
brw-rw----. 1 grid asmadmin 253, 7 Dec 23 15:21 /dev/dm-7
brw-rw----. 1 grid asmadmin 253, 8 Dec 23 15:21 /dev/dm-8
brw-rw----. 1 grid asmadmin 253, 9 Dec 23 15:21 /dev/dm-9
说明:将多路径设备 spathc 建立了两个均等大小的主分区和扩展分区。
命令“ parted /dev/mapper/spathc”选定需要分区的设备;
“ mklabel gpt”设置分区类型为 GPT;
“ mkpart primary 0 50%”建立 primary 主分区, 0 是分区开始位置, 50%是分区结束位置,分区大小为设备总容量的50%;
“ mkpart extended 50% 100%”建立 extended 扩展分区,同样 50%是分区开始位置, 100%是分区结束位置,分区大小为设备总容量的剩余 50%。
分区的起始位置也可根据实际需要以数字指定,默认是 MB 为单位,也可指定以 GB 为单位,
如“ mkpart primary 100 100GB”建立的主分区开始位置为 100MB,结束位置为 100GB。
“ mkpart /dev/mapper/spathc print”命令打印当前分区,以检查分区是否建立正确。
使用 parted 建立分区的多路径磁盘,已自动将分区添加到设备分区表中。查看/dev/mapper/下会看到 spath*p1 的分区名。