Linux 自带Multipath多路径配置
# 扫描识别新划分的硬盘
方法1:#推荐使用次命令,次命令经过工作实践的,是不会影响业务的。
1. 查看主机总线号
root@node /]# ls /sys/class/scsi_host/
host0 host1
2.重新扫描SCSI总线来添加设备
[root@node /]# echo "- - -" > /sys/class/scsi_host/host0/scan
# 简易循环方式(推荐)
for h in $( ls /sys/class/scsi_host/ | awk -F"host" '{print $2}'| sort -n)
do
echo "- - -" >/sys/class/scsi_host/host$h/scan
done
# for h in $( ls /sys/class/fc_host/ | awk -F"host" '{print $2}'| sort -n); do echo "host$h wwn: $(cat /sys/class/fc_host/host${h}/port_name)"; done
for h in $( ls /sys/class/fc_host/ | awk -F"host" '{print $2}'| sort -n)
do
echo "host$h wwn: $(cat /sys/class/fc_host/host${h}/port_name)"
done
方法2:
echo "1" > /sys/class/fc_host/host8/issue_lip
# 安装 multipath 软件
rpm -qa | grep device-mapper
yum install -y device-mapper device-mapper-multipath
# 生成配置文件
mpathconf --enable --with_multipathd y
# 日立多路径查看磁盘对应关系
[root@Ora-Mes-FuZhu-Prod-RAC1 soft]# dlnkmgr view -lu
Product : VSP_Gx00
SerialNumber : 416002
LUs : 6
iLU HDevName Device PathID Status
000100 sddlmaa /dev/sdb 000000 Online
/dev/sdh 000006 Online
/dev/sdn 000012 Online
/dev/sdt 000013 Online
000101 sddlmab /dev/sdc 000001 Online
/dev/sdi 000007 Online
/dev/sdo 000014 Online
/dev/sdu 000015 Online
000102 sddlmac /dev/sdd 000002 Online
/dev/sdj 000008 Online
/dev/sdp 000016 Online
/dev/sdv 000017 Online
000103 sddlmad /dev/sde 000003 Online
/dev/sdk 000009 Online
/dev/sdq 000018 Online
/dev/sdw 000019 Online
000104 sddlmae /dev/sdf 000004 Online
/dev/sdl 000010 Online
/dev/sdr 000020 Online
/dev/sdx 000021 Online
000105 sddlmaf /dev/sdg 000005 Online
/dev/sdm 000011 Online
/dev/sds 000022 Online
/dev/sdy 000023 Online
# multipath -ll | grep HUAWEI | sort
mpatha (3694b27110033ceef4383337b00000002) dm-4 HUAWEI ,XSG1
mpathb (3694b27110033ceef4383337b00000003) dm-5 HUAWEI ,XSG1
mpathc (3694b27110033ceef4383337b00000004) dm-6 HUAWEI ,XSG1
mpathd (3694b27110033ceef4383337b00000005) dm-7 HUAWEI ,XSG1
mpathe (3694b27110033ceef4383337b00000006) dm-8 HUAWEI ,XSG1
mpathf (3694b27110033ceef4383337b00000007) dm-9 HUAWEI ,XSG1
mpathg (3694b27110033ceef4383337b00000008) dm-10 HUAWEI ,XSG1
mpathh (3694b27110033ceef4383337b00000009) dm-11 HUAWEI ,XSG1
mpathi (3694b27110033ceef4383337b0000000a) dm-12 HUAWEI ,XSG1
# multipath -ll | grep HUAWEI | sort | awk '{print $1}'
[root@Ora-Mes-FuZhu-Prod-RAC2 ~]# for i in $(multipath -ll | grep HUAWEI | sort | awk '{print $1}'); do echo -e "$(fdisk -l | grep $i)\nwwid:$(/usr/lib/udev/scsi_id -g -u /dev/mapper/$i)"; done
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/mapper/mpatha: 53.7 GB, 53687091200 bytes, 104857600 sectors
wwid:3694b27110033ceef4383337b00000002
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/mapper/mpathb: 53.7 GB, 53687091200 bytes, 104857600 sectors
wwid:3694b27110033ceef4383337b00000003
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/mapper/mpathc: 53.7 GB, 53687091200 bytes, 104857600 sectors
wwid:3694b27110033ceef4383337b00000004
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/mapper/mpathd: 536.9 GB, 536870912000 bytes, 1048576000 sectors
wwid:3694b27110033ceef4383337b00000005
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/mapper/mpathe: 536.9 GB, 536870912000 bytes, 1048576000 sectors
wwid:3694b27110033ceef4383337b00000006
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/mapper/mpathf: 536.9 GB, 536870912000 bytes, 1048576000 sectors
wwid:3694b27110033ceef4383337b00000007
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/mapper/mpathg: 536.9 GB, 536870912000 bytes, 1048576000 sectors
wwid:3694b27110033ceef4383337b00000008
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/mapper/mpathh: 536.9 GB, 536870912000 bytes, 1048576000 sectors
wwid:3694b27110033ceef4383337b00000009
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/mapper/mpathi: 536.9 GB, 536870912000 bytes, 1048576000 sectors
wwid:3694b27110033ceef4383337b0000000a
# 查看scsi_id
# /usr/lib/udev/scsi_id -g -u /dev/mapper/mpatha
360060e80123e820050403e8200000100
# 修改配置文件
cp /etc/multipath.conf /etc/multipath.conf.bak
# sed -i '/^/s/^/#/' /etc/multipath.conf
cat <<EOF> /etc/multipath.conf
defaults {
user_friendly_names yes
}
blacklist {
devnode "^sda"
devnode "^sddlma"
}
multipaths {
multipath {
wwid "3694b27110033ceef4383337b00000002"
alias asm_hw_ocr01
}
multipath {
wwid "3694b27110033ceef4383337b00000003"
alias asm_hw_ocr02
}
multipath {
wwid "3694b27110033ceef4383337b00000004"
alias asm_hw_ocr03
}
multipath {
wwid "3694b27110033ceef4383337b00000005"
alias asm_hw_fra01
}
multipath {
wwid "3694b27110033ceef4383337b00000006"
alias asm_hw_fra02
}
multipath {
wwid "3694b27110033ceef4383337b00000007"
alias asm_hw_data01
}
multipath {
wwid "3694b27110033ceef4383337b00000008"
alias asm_hw_data02
}
multipath {
wwid "3694b27110033ceef4383337b00000009"
alias asm_hw_data03
}
multipath {
wwid "3694b27110033ceef4383337b0000000a"
alias asm_hw_data04
}
}
EOF
激活multipath多路径:
multipath -F
multipath -v2
multipath -ll
Linux 自带Multipath多路径配置
于 2023-06-01 10:26:24 首次发布
715

被折叠的 条评论
为什么被折叠?



