it江湖漂,怎能不挨刀;一朝机器当,看你怎么着!
分类: LINUX
2009-09-29 17:49:21
问题场景是IBM刀片(hs21和js12)接HP的EVA5000存储。由于HP存储采用双控制器和双交换机机,所以需要在IBM刀片上启用多路径功能。IBM自身的多路径软件只能用在自身的存贮上,因此只能使用REDHAT的方案。
首先确认系统中是否已经安装了device-mapper工具
[root@mailMx1 ~]# rpm -qa|grep device
device-mapper-multipath-0.4.7-17.el5
device-mapper-event-1.02.24-1.el5
device-mapper-1.02.24-1.el5
在系统中,执行
fdisk -l 可以看到
Disk /dev/sda: 145.9 GB, 145999527936 bytes
255 heads, 63 sectors/track, 17750 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 200781 83 Linux
/dev/sda2 26 3849 30716280 83 Linux
/dev/sda3 3850 4893 8385930 82 Linux swap / Solaris
/dev/sda4 4894 17750 103273852+ 5 Extended
/dev/sda5 4894 17750 103273821 83 Linux
Disk /dev/sdb: 1395.8 GB, 1395864371200 bytes
255 heads, 63 sectors/track, 169704 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 1395.8 GB, 1395864371200 bytes
255 heads, 63 sectors/track, 169704 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
Disk /dev/sdd: 1395.8 GB, 1395864371200 bytes
255 heads, 63 sectors/track, 169704 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdd doesn't contain a valid partition table
Disk /dev/sde: 1395.8 GB, 1395864371200 bytes
255 heads, 63 sectors/track, 169704 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sde doesn't contain a valid partition table
其中,sdb,sdc,sdd,sde为通过多路径看到的两块磁盘,此处显示为4块。
输入multipath -v3可以看到
[root@mailMx1 etc]# multipath -v3
dm-0: blacklisted
dm-1: blacklisted
dm-2: blacklisted
dm-3: blacklisted
md0: blacklisted
ram0: blacklisted
ram10: blacklisted
ram11: blacklisted
ram12: blacklisted
ram13: blacklisted
ram14: blacklisted
ram15: blacklisted
ram1: blacklisted
ram2: blacklisted
ram3: blacklisted
ram4: blacklisted
ram5: blacklisted
ram6: blacklisted
ram7: blacklisted
ram8: blacklisted
ram9: blacklisted
sda: blacklisted
sdb: not found in pathvec
sdb: mask = 0x1f
sdb: bus = 1
sdb: dev_t = 8:16
sdb: size = 2726297600
sdb: vendor = COMPAQ
sdb: product = HSV111 (C)COMPAQ
sdb: rev = 4100
sdb: h:b:t:l = 3:0:0:1
sdb: tgt_node_name = 0x50001fe1500452f0
sdb: serial = P5849E3AASC00W
sdb: path checker = hp_sw (controller setting)
sdb: state = 2
sdb: getprio = /sbin/mpath_prio_alua /dev/%n (controller setting)
sdb: prio = 50
sdb: getuid = /sbin/scsi_id -g -u -s /block/%n (controller setting)
sdb: uid = 3600508b4001013f70001900004230000 (callout)
sdc: not found in pathvec
sdc: mask = 0x1f
sdc: bus = 1
sdc: dev_t = 8:32
sdc: size = 2726297600
sdc: vendor = COMPAQ
sdc: product = HSV111 (C)COMPAQ
sdc: rev = 4100
sdc: h:b:t:l = 3:0:0:2
sdc: tgt_node_name = 0x50001fe1500452f0
sdc: serial = P5849E3AASC00W
sdc: path checker = hp_sw (controller setting)
sdc: state = 2
sdc: getprio = /sbin/mpath_prio_alua /dev/%n (controller setting)
sdc: prio = 10
sdc: getuid = /sbin/scsi_id -g -u -s /block/%n (controller setting)
sdc: uid = 3600508b4001013f70001900004320000 (callout)
sdd: not found in pathvec
sdd: mask = 0x1f
sdd: bus = 1
sdd: dev_t = 8:48
sdd: size = 2726297600
sdd: vendor = COMPAQ
sdd: product = HSV111 (C)COMPAQ
sdd: rev = 4100
sdd: h:b:t:l = 3:0:1:1
sdd: tgt_node_name = 0x50001fe1500452f0
sdd: serial = P5849E1AAQH01M
sdd: path checker = hp_sw (controller setting)
sdd: state = 2
sdd: getprio = /sbin/mpath_prio_alua /dev/%n (controller setting)
sdd: prio = 10
sdd: getuid = /sbin/scsi_id -g -u -s /block/%n (controller setting)
sdd: uid = 3600508b4001013f70001900004230000 (callout)
sde: not found in pathvec
sde: mask = 0x1f
sde: bus = 1
sde: dev_t = 8:64
sde: size = 2726297600
sde: vendor = COMPAQ
sde: product = HSV111 (C)COMPAQ
sde: rev = 4100
sde: h:b:t:l = 3:0:1:2
sde: tgt_node_name = 0x50001fe1500452f0
sde: serial = P5849E1AAQH01M
sde: path checker = hp_sw (controller setting)
sde: state = 2
sde: getprio = /sbin/mpath_prio_alua /dev/%n (controller setting)
sde: prio = 50
sde: getuid = /sbin/scsi_id -g -u -s /block/%n (controller setting)
sde: uid = 3600508b4001013f70001900004320000 (callout)
===== paths list =====
uuid hcil dev dev_t pri dm_st chk_st vend/pr
3600508b4001013f70001900004230000 3:0:0:1 sdb 8:16 50 [undef][ready] COMPAQ,
3600508b4001013f70001900004320000 3:0:0:2 sdc 8:32 10 [undef][ready] COMPAQ,
3600508b4001013f70001900004230000 3:0:1:1 sdd 8:48 10 [undef][ready] COMPAQ,
3600508b4001013f70001900004320000 3:0:1:2 sde 8:64 50 [undef][ready] COMPAQ,
params = 1 queue_if_no_path 0 1 1 round-robin 0 2 1 8:32 1000 8:64 1000
status = 2 0 0 0 1 1 A 0 2 0 8:32 A 0 8:64 A 0
params = 1 queue_if_no_path 0 1 1 round-robin 0 2 1 8:16 1000 8:48 1000
status = 2 0 0 0 1 1 A 0 2 0 8:16 A 0 8:48 A 0
sdb: ownership set to maildata1
sdb: not found in pathvec
sdb: mask = 0xc
sdb: state = 2
sdb: prio = 50
sdd: ownership set to maildata1
sdd: not found in pathvec
sdd: mask = 0xc
sdd: state = 2
sdd: prio = 10
maildata1: pgfailback = -2 (controller setting)
maildata1: pgpolicy = multibus (LUN setting)
maildata1: selector = round-robin 0 (LUN setting)
maildata1: features = 0 (internal default)
maildata1: hwhandler = 0 (controller setting)
maildata1: rr_weight = 1 (internal default)
maildata1: minio = 1000 (config file default)
maildata1: no_path_retry = 12 (controller setting)
pg_timeout = NONE (internal default)
maildata1: set ACT_NOTHING (map unchanged)
sdc: ownership set to maildata2
sdc: not found in pathvec
sdc: mask = 0xc
sdc: state = 2
sdc: prio = 10
sde: ownership set to maildata2
sde: not found in pathvec
sde: mask = 0xc
sde: state = 2
sde: prio = 50
maildata2: pgfailback = -2 (controller setting)
maildata2: pgpolicy = multibus (LUN setting)
maildata2: selector = round-robin 0 (LUN setting)
maildata2: features = 0 (internal default)
maildata2: hwhandler = 0 (controller setting)
maildata2: rr_weight = 1 (internal default)
maildata2: minio = 1000 (config file default)
maildata2: no_path_retry = 12 (controller setting)
pg_timeout = NONE (internal default)
maildata2: set ACT_NOTHING (map unchanged)
根据以上信息,就可以直接编辑配置文件,位于/etc/multipath.conf
主要修改以下部分
将本机硬盘从多路径中去掉,
blacklist {
devnode "^sda"
}
添加多路径映射设备,其中别名alias可以自己起。
multipaths {
# multipath {
# wwid 3600508b4000156d700012000000b0000
# alias yellow
# path_grouping_policy multibus
# path_checker readsector0
# path_selector "round-robin 0"
# failback manual
# rr_weight priorities
# no_path_retry 5
# }
multipath {
wwid 3600508b4001013f70001900004230000
alias maildata1
path_grouping_policy multibus
path_checker tur
path_selector "round-robin 0"
}
multipath {
wwid 3600508b4001013f70001900004320000
alias maildata2
path_grouping_policy multibus
path_checker tur
path_selector "round-robin 0"
}
}
添加多路径设备,注意要用到前面收集的信息,特别是path_checker要和前面一致
devices {
device {
vendor "COMPAQ|HP"
product "HSV111 \(C\)COMPAQ"
path_grouping_policy group_by_serial
getuid_callout "/sbin/scsi_id -g -u -s /block/%n"
path_checker hp_sw
path_selector "round-robin 0"
prio_callout "/sbin/mpath_prio_alua /dev/%n"
hardware_handler "0"
failback immediate
rr_weight uniform
no_path_retry 12
}
# device {
# vendor "COMPAQ "
# product "MSA1000 "
# path_grouping_policy multibus
# }
}
这样,使用multipath -ll就可以看到
[root@mailMx1 etc]# multipath -ll
maildata2 (3600508b4001013f70001900004320000) dm-1 COMPAQ,HSV111 (C)COMPAQ
[size=1.3T][features=1 queue_if_no_path][hwhandler=0]
\_ round-robin 0 [prio=60][active]
\_ 3:0:0:2 sdc 8:32 [active][ready]
\_ 3:0:1:2 sde 8:64 [active][ready]
maildata1 (3600508b4001013f70001900004230000) dm-0 COMPAQ,HSV111 (C)COMPAQ
[size=1.3T][features=1 queue_if_no_path][hwhandler=0]
\_ round-robin 0 [prio=60][active]
\_ 3:0:0:1 sdb 8:16 [active][ready]
\_ 3:0:1:1 sdd 8:48 [active][ready]
说明设备已经配置完毕,可以看到,我们将4个设备聚合成了两个设备,分别是maildata1和maildata2。
这两个设备的位置在/dev/mapper下