使用multipath创建asm磁盘
员工经过长期磨合与沉淀,具备了协作精神,得以通过团队的力量开发出优质的产品。创新互联坚持“专注、创新、易用”的产品理念,因为“专注所以专业、创新互联网站所以易用所以简单”。公司专注于为企业提供网站建设、成都网站设计、微信公众号开发、电商网站开发,小程序开发,软件按需求定制设计等一站式互联网企业服务。
创建asm磁盘的方法格式各样,本文主要为了标准化,统一采用multipath与udev结合管理asm磁盘.适用于linux6 ,linux7,多路径或者单一路径.
以下操作使用oracle linux 7为例.
1.安装multipath软件
yum源使用oracle官方源或者本地iso源
[root@oel7 ~]# yum provides multipath
Loaded plugins: ulninfo
device-mapper-multipath-0.4.9-119.el7.x86_64 : Tools to manage multipath devices using device-mapper
Repo : dbinstall
Matched from:
Filename : /usr/sbin/multipath
# yum install device-mapper-multipath-0.4.9-119.el7.x86_64
2.加载模块&创建配置文件
初次安装需要加载dm模块
# modprobe dm-multipath
# modprobe dm-round-robin
# cp /usr/share/doc/device-mapper-multipath-*/multipath.conf /etc/multipath.conf
3.编辑配置文件 /etc/multipath.conf
devices {
device {
vendor "VMware, "
product "VMware Virtual S"
path_grouping_policy multibus
path_checker readsector0
path_selector "round-robin 0"
hardware_handler "0"
failback 15
rr_weight priorities
no_path_retry queue
}
}
multipaths {
multipath {
wwid 36000c29b9e405c3d07021157ace9ab9f
alias asm_data01
}
multipath {
wwid 36000c2933be13ffabcb0ce90806ea5dd
alias asm_fra01
}
}
4.查看multipath设备
重启服务
# systemctl restart multipathd
# multipath -ll
由于是虚拟机且非多路径,并没有生成相关设备.此时我们手动添加wwid到multipath信息库.若为真实多路径,无需手动添加
multipath -a /dev/sdb
multipath -a /dev/sdc
再次重启服务
# systemctl restart multipathd
查看设备
# multipath -ll
asm_fra01 (36000c2933be13ffabcb0ce90806ea5dd) dm-3 VMware, ,VMware Virtual S
size=10G features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
`- 0:0:2:0 sdc 8:32 active ready running
asm_data01 (36000c29b9e405c3d07021157ace9ab9f) dm-2 VMware, ,VMware Virtual S
size=30G features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
`- 0:0:1:0 sdb 8:16 active ready running
5.配置udev规则
前面做了这么多工作主要为了udev规则配置简单
来看下multipath管理的设备特点
[root@oel7 ~]# udevadm info -q all -n /dev/mapper/asm_data01
P: /devices/virtual/block/dm-2
N: dm-2
L: 10
S: disk/by-id/dm-name-asm_data01
S: disk/by-id/dm-uuid-mpath-36000c29b9e405c3d07021157ace9ab9f
S: disk/by-label/DATA1
S: mapper/asm_data01
E: DEVLINKS=/dev/disk/by-id/dm-name-asm_data01 /dev/disk/by-id/dm-uuid-mpath-36000c29b9e405c3d07021157ace9ab9f /dev/disk/by-label/DATA1 /dev/mapper/asm_data01
E: DEVNAME=/dev/dm-2
E: DEVPATH=/devices/virtual/block/dm-2
E: DEVTYPE=disk
E: DM_MULTIPATH_TIMESTAMP=1536682254
E: DM_NAME=asm_data01
E: DM_SUSPENDED=0
E: DM_UDEV_DISABLE_LIBRARY_FALLBACK_FLAG=1
E: DM_UDEV_PRIMARY_SOURCE_FLAG=1
E: DM_UDEV_RULES_VSN=2
E: DM_UUID=mpath-36000c29b9e405c3d07021157ace9ab9f
E: ID_FS_LABEL=DATA1
E: ID_FS_LABEL_ENC=DATA1
E: ID_FS_TYPE=oracleasm
E: ID_FS_USAGE=filesystem
E: MAJOR=249
E: MINOR=2
E: MPATH_SBIN_PATH=/sbin
E: SUBSYSTEM=block
E: TAGS=:systemd:
E: USEC_INITIALIZED=83840
利用着色部分做udev规则
cat >> /etc/udev/rules.d/99-oracle-asmdevices.rules < KERNEL=="dm-*",ENV{DM_UUID}=="mpath-?*",ENV{DM_NAME}=="asm_?*",OWNER="grid",GROUP="asmadmin",MODE="0660" END 启动udev # udevadm trigger -c change linux6用start_udev 查看权限 [root@oel7 ~]# ll /dev/dm* brw-rw----. 1 root disk 249, 0 Sep 12 00:33 /dev/dm-0 brw-rw----. 1 root disk 249, 1 Sep 12 00:33 /dev/dm-1 brw-rw----. 1 grid asmadmin 249, 2 Sep 12 00:33 /dev/dm-2 brw-rw----. 1 grid asmadmin 249, 3 Sep 12 00:33 /dev/dm-3 至此asm磁盘就创建成功了.
文章题目:使用multipath创建asm磁盘
新闻来源:http://kswsj.cn/article/jioeig.html