Linux 下配置多路径及SCSI扫描磁盘重新发现大小
1)、Linux SCSI扫描磁盘重新发现大小:
# for i in `find /sys/class/scsi_host/host*`;do echo "- - -" > $i/scan; done
# for i in `find /sys/class/scsi_device/*`;do echo 1 > $i/device/rescan; done
2、安装多路径软件包:
device-mapper-1.02.67-2.el5
device-mapper-event-1.02.67.2.el5
device-mapper-multipath-0.4.7-48.el5
# rpm -ivh device-mapper-1.02.67-2.el5.x86_64.rpm
# rpm -ivh device-mapper-event-1.02.67-2.el5.x86_64.rpm
# yum install device-mapper-multipath #配置光盘yum源 ,光盘自带有
3. 编写multipath.conf配置文件
# 把存储厂商和产品型号添加到信任中:blacklist_exceptions # 如何查看厂商信息:#cat /proc/scsi/scsi # 会出现存储厂商的信息 # Host: scsi1 Channel: 00 Id: 00 Lun: 00 # Vendor: DGC Model: VRAID Rev: 5003 # Type: Direct-Access ANSI SCSI revision: 06 blacklist_exceptions { device { vendor "DGC" product "VRAID" } device { vendor "DGC" product "LUNZ" } } # 保持默认 defaults { user_friendly_names yes } # 以下配置是不聚合的卷,一般情况下,我们会把系统盘sda排除掉 # 如何查看sda的wwid ?: /lib/udev/scsi_id -g -u -d /dev/sda blacklist { wwid 361866da086a6d8001fdf69be185a6e85 # devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*" # devnode "^hd[a-z]" } # 表示聚合的盘,显示的友好名字
# 查看wwid 还是用:
# /lib/udev/scsi_id -g -u -d /dev/卷 multipaths { multipath { wwid 36006016062a051004cdd515f6a89f542 alias OCR_VOTE-1 } } #以下配置信息,是针对存储厂商设置的参数信息; #可以保持默认,或者参考Redhat 官网的配置;https://access.redhat.com/documentation/zh-cn/red_hat_enterprise_linux/6/html/dm_multipath/config_file_devices devices { device { vendor "DGC" product "VRAID" # path_grouping_policy multibus path_grouping_policy group_by_prio features "3 queue_if_no_path pg_init_retries 50" prio "emc" path_checker tur failback immediate path_selector "round-robin 0" hardware_handler "1 emc" rr_weight uniform rr_min_io 128 getuid_callout "/lib/udev/scsi_id -g -u -d /dev/%n" } device { vendor "DGC" product "LUNZ" path_grouping_policy group_by_prio features "3 queue_if_no_path pg_init_retries 50" prio "emc" path_checker tur failback immediate path_selector "round-robin 0" hardware_handler "1 emc" rr_weight uniform rr_min_io 128 getuid_callout "/lib/udev/scsi_id -g -u -d /dev/%n" } }
2、设置开机启动,并检查安装包是否正常:
# modprobe dm-multipath
# chkconfig --level 345 multipathd on
# lsmod |grep dm_multipath
dm_multipath 58969 0
scsi_dh 42561 1 dm_multipath
dm_mod 102417 4 dm_mirror,dm_multipath,dm_raid45,dm_log
# service multipathd restart
正在关闭multipathd 端口监控程序: [确定]
正在启动守护进程multipathd: [确定]
multipath常用命令
# multipath -r #修改multipath.conf配置文件之后重新加载
# multipath -ll #查看多路径状态
# multipath -v2 #格式化路径,检测路径,合并路径
# multipath -v3 #查看多路径详情blacklist、whitelist和设备wwid
# multipath -F #删除现有链路
# multipath -v2
# multipath -ll #看到如下信息,表示配置正常了
其实 聚合后的卷:ASM_DATA-10 的wwid号与 sdo 、sdaq、sdac、sdbe 是一样的,且这4个卷的wwid号一致,只是有4条路径而已;