RHEL6配置multipath多路径软件连存储

 

 RHEL6与5在多路径的配置上有一些小区别。scsi_id命令有些参数不再支持。在RHEL 6中获取磁盘的wwid可以通过–whitelist参数获取:[root@db1 ~]# scsi_id --whitelist /dev/sdg 360060160a2212f00f8139df761ece111

  www.2cto.com  

可以通过一条shell命令,来获取系统所有磁盘的wwid:

# for i in `cat /proc/partitions awk {'print $4'} grep sd`; do echo "### $i: `scsi_id --whitelist /dev/$i`"; done

在RHEL 5中,可以通过如下方式获取磁盘wwid:

# for i in `cat /proc/partitions awk {'print $4'} grep sd`; do echo "### $i: `scsi_id -g -u -s /block/$i`"; done

另外,RHEL 6中,多路径配置文件也出现变化:

 

# multipath.conf written by anaconda

defaults {

user_friendly_names yes

}

blacklist {

devnode "^(ramrawloopfdmddm-srscdst)[0-9]*"

devnode "^hd[a-z]"

devnode "^dcssblk[0-9]*"

device {

vendor "DGC"

product "LUNZ"

}

device {

vendor "IBM"

product "S/390.*"

}

# don't count normal SATA devices as multipaths

device {

vendor "ATA"

}

# don't count 3ware devices as multipaths

device {

vendor "3ware"

}

device {

vendor "AMCC"

}

# nor highpoint devices

device {

vendor "HPT"

}

wwid "20080930-1"

wwid "20080930-1"

device {

vendor Cisco

product Virtual_CD_DVD

}

wwid "*" //其实可以注释这项,这样就不需要单独填写blacklist_exceptions

}

blacklist_exceptions { //排除在黑名单之外的wwid

wwid "360060160a2212f00a67e0b91f2dbe111"

wwid "360060160a2212f0044a0fc6ef5eae111"

}

multipaths {

multipath {

uid 0 //磁盘读所属用户uid

gid 0 //磁盘所属组gid

wwid "360060160a2212f00a67e0b91f2dbe111" //wwid号

mode 0600 //磁盘读写权限

}

multipath {

wwid "360060160a2212f0044a0fc6ef5eae111"

alias data //别名

}

... ... //还可以根据实际情况,配置其它磁盘的别名、uid、gid、mode etc...

}

  www.2cto.com  

 

配置完了之后,重启multipathd服务,之后通过multipath -ll查看经过多路径软件绑定后的磁盘。

注意,如果要对磁盘进行格式化,请采用/dev/mapper/[alias]这类设备名进行fdisk。