本章自行选择,可以不更改但是你要知道你共享磁盘的名字
1.安装device-mapper-multipath 和 device-mapper包
yum install device-mapper-multipath device-mapper -y
设置开机自动启动多路径 systemctl enable multipathd.service 启动多路径 systemctl start multipathd.service 配置multipath.conf /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf /etc/multipath.conf /sbin/mpathconf --enable
进入multipath查看bindings文件
cat /etc/multipath/bindings
2.查看共享磁盘id
for i in b c d e f g h i j k l m n o; do echo "sd$i" "`/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i` "; done
我们可以发现有重复的,是因为我们在storage存储主机上配置了两个网卡ip ,接下来我们要除重
3.查找磁盘大小信息
fdisk -l | grep /dev/
我们把1,2,3获得的磁盘信息可以得出每个磁盘wwid号和大小
mpatha 3600140554e172f50d0c412d8a21ec059 10g mpathb 360014055eb70520e8f84ca6857932720 10g mpathc 3600140506aea346e2fe46fbbc8610939 10g mpathd 360014051f5750a3a5fe48f9a1a68580e 20g mpathe 36001405b8abf9f94a654763a79139a42 20g mpathf 36001405e0b39bd0b9b4457a9111127f9 20g mpathg 3600140546904802424147ff8274edf04 20g
4.修改磁盘名称
修改/etc/multipath.conf
vim /etc/multipath.conf
sda是系统的40g磁盘,我们增加了10g*3,20g*4,接下来修改每个磁盘的名称
只需修改wwid(磁盘id号),和alias(自己想要的名称)
defaults { user_friendly_names yes find_multipaths yes } blacklist { #sda是系统盘不参与多路径共享存储 #wwid 26353900f02796769 #devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*" devnode "^sd[a]" } multipaths { multipath { wwid 360014051f5750a3a5fe48f9a1a68580e alias oracle-data01 path_grouping_policy multibus path_selector "round-robin 0" failback immediate } multipath { wwid 36001405b8abf9f94a654763a79139a42 alias oracle-data02 path_grouping_policy multibus path_selector "round-robin 0" failback immediate } multipath { wwid 36001405e0b39bd0b9b4457a9111127f9 alias oracle-data03 path_grouping_policy multibus path_selector "round-robin 0" failback immediate } multipath { wwid 3600140546904802424147ff8274edf04 alias oracle-data04 path_grouping_policy multibus path_selector "round-robin 0" failback immediate } multipath { wwid 3600140554e172f50d0c412d8a21ec059 alias oracle-ocr01 path_grouping_policy multibus path_selector "round-robin 0" failback immediate } multipath { wwid 360014055eb70520e8f84ca6857932720 alias oracle-ocr02 path_grouping_policy multibus path_selector "round-robin 0" failback immediate } multipath { wwid 3600140506aea346e2fe46fbbc8610939 alias oracle-ocr03 path_grouping_policy multibus path_selector "round-robin 0" failback immediate } } devices { device { vendor "openfiler " product "virtual-disk" path_grouping_policy multibus path_checker readsector0 path_selector "round-robin 0" hardware_handler "0" } }
5.重启服务和查看磁盘情况
重启服务
systemctl restart multipathd.service
多路径检验
multipath -ll
名称修改成功