根据模板新增12-dm-permissions.rules文件在/etc/udev/rules.d/下面:
vi /etc/udev/rules.d/12-dm-permissions.rules
# MULTIPATH DEVICES
#
# Set permissions for all multipath devices
ENV{DM_UUID}=="mpath-?*", OWNER:="grid", GROUP:="asmadmin", MODE:="660"
# Set permissions for first two partitions created on a multipath device (and detected by kpartx)
# ENV{DM_UUID}=="part[1-2]-mpath-?*", OWNER:="root", GROUP:="root", MODE:="660"
查看多路径对应的底层dm设备:
[root@jyrac2 rules.d]# ls -lh /dev/dm*
brw-rw---- 1 root disk 253, 0 Jul 19 16:40 /dev/dm-0
brw-rw---- 1 root disk 253, 1 Jul 19 16:40 /dev/dm-1
brw-rw---- 1 root disk 253, 2 Jul 19 21:20 /dev/dm-2
brw-rw---- 1 root disk 253, 3 Jul 19 21:20 /dev/dm-3
--启动start_udev
[root@jyrac2 rules.d]# start_udev
Starting udev: [ OK ]
--查看权限:
[root@jyrac2 rules.d]# ls -lh /dev/dm*
brw-rw---- 1 root disk 253, 0 Jul 19 21:35 /dev/dm-0
brw-rw---- 1 root disk 253, 1 Jul 19 21:35 /dev/dm-1
brw-rw---- 1 grid asmadmin 253, 2 Jul 19 21:35 /dev/dm-2
brw-rw---- 1 grid asmadmin 253, 3 Jul 19 21:35 /dev/dm-3
--等30s后再查,权限固定:
[root@jyrac2 rules.d]# ls -lh /dev/dm*
brw-rw---- 1 root disk 253, 0 Jul 19 21:35 /dev/dm-0
brw-rw---- 1 root disk 253, 1 Jul 19 21:35 /dev/dm-1
brw-rw---- 1 grid asmadmin 253, 2 Jul 19 21:35 /dev/dm-2
brw-rw---- 1 grid asmadmin 253, 3 Jul 19 21:35 /dev/dm-3
发现权限固定不变没有问题了,在RAC的另一个节点也同样设置。
这时多路径的信息再查看下:
[root@jyrac1 ~]# multipath -ll
mpathi (1IET 00010002) dm-2 IET,VIRTUAL-DISK
size=10G features='0' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=1 status=active
| `- 13:0:0:2 sdk 8:160 active ready running
`-+- policy='round-robin 0' prio=1 status=enabled
`- 12:0:0:2 sdl 8:176 active ready running
mpathg (1IET 00010001) dm-3 IET,VIRTUAL-DISK
size=10G features='0' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=1 status=active
| `- 13:0:0:1 sdi 8:128 active ready running
`-+- policy='round-robin 0' prio=1 status=enabled
`- 12:0:0:1 sdj 8:144 active ready running
[root@jyrac1 ~]#
在另一个节点也要达到同样效果。
6.新建ASM磁盘组测试
使用grid用户登录xmanager图形界面调出asmca,创建一个新的磁盘组data2,使用这两个盘。冗余度选择Normal冗余:
最终加磁盘组成功,对应查询磁盘组和磁盘的相关信息如下:
SQL> select group_number, disk_number, name, path, mode_status, voting_file from v$asm_disk order by 1,2;
GROUP_NUMBER DISK_NUMBER NAME PATH MODE_ST V
------------ ----------- ------------------------------ -------------------------------------------------- ------- -
1 0 DATA1_0000 /dev/asm-diske ONLINE N
1 1 DATA1_0001 /dev/asm-diskf ONLINE N
1 2 DATA1_0002 /dev/asm-diskg ONLINE N
2 0 FRA1_0000 /dev/asm-diskh ONLINE N
3 0 OCR1_0000 /dev/asm-diskb ONLINE Y
3 1 OCR1_0001 /dev/asm-diskc ONLINE Y
3 2 OCR1_0002 /dev/asm-diskd ONLINE Y
4 0 DATA2_0000 /dev/mapper/mpathg ONLINE N
4 1 DATA2_0001 /dev/mapper/mpathi ONLINE N
9 rows selected.
SQL> select group_number, name, total_mb, free_mb, usable_file_mb, offline_disks, state, type from v$asm_diskgroup;