linux服务器通过multipath多路径连接到共享存储,那么当文件系统空间不足的时候,有几种方式可以扩展文件系统的大小:
1、pv不变,原lun存储扩大容量,扩大lv,扩大文件系统
2、新增pv,加入到vg中,扩大lv,扩大文件系统
下文是针对场景1的情况下如何 *** 作(但是个人建议采取新建pv的方式2进行):
Environment
If you have this specific scenario, you can use the following steps:
Note: if these lv's are part of a clustered vg, steps 1 and 2 need to be performed on all nodes. 注意:集群模式下步骤1和步骤2两个节点都需要执行。
1) Update block devices
Note: This step needs to be run against any sd devices mapping to that lun. When using multipath, there will be more than one. 通过multipath -ll命令查看每个聚合卷对应的路径。
2) Update multipath device
例子:
3) Resize the physical volume, which will also resize the volume group
4) Resize your logical volume (the below command takes all available space in the vg)
5) Resize your filesystem
6) Verify vg, lv and filesystem extension has worked appropriately
模拟存储端扩容testlv增加
查看客户端多路径情况
客户端更新存储
更新聚合设备
更新pv空间
更新lv空间
更新文件系统空间
fdisk -l看到的是逻辑设备。譬如你存储映射到主机的一个LUN,经过两条路径到主机上,那么在主机上fdisk -l就会看到两块逻辑上的磁盘,事实上这两块磁盘是同一个物理设备(对于主机来说,LUN是物理设备),通过multipath -ll看到的是一个物理设备下的实际的两条path。一、多路径解释多路径,顾名思义就是有多种选择的路径。在SAN或IPSAN环境,主机和存储之间外加了光纤交换机,这就导致主机和存储之间交换速度和效率增强,一条路径肯定是不行的,也是不安全不稳定的。多路径就是要来解决从主机到磁盘之间最快,最高效的问题。主要实现如下几个功能
故障的切换和恢复
IO流量的负载均衡
磁盘的虚拟化
多路径之前一直是存储厂商负责解决,竟来被拆分出来单独卖钱了。
构架基本是这样的:存储,多路径软件,光纤交换机,主机,主机系统。
二、LINUX下的multipath
1、查看是否自带安装?
1
2
3
4
5
6
[root@web2 multipath]# rpm -qa|grep device
device-mapper-1.02.39-1.el5
device-mapper-1.02.39-1.el5
device-mapper-multipath-0.4.7-34.el5
device-mapper-event-1.02.39-1.el5
[root@web2 multipath]#
2、安装
1
2
3
4
5
6
rpm -ivh device-mapper-1.02.39-1.el5.rpm#安装映射包
rpm -ivh device-mapper-multipath-0.4.7-34.el5.rpm #安装多路径包
外加加入开机启动
chkconfig –level 2345 multipathd on #设置成开机自启动multipathd
lsmod |grep dm_multipath #来检查安装是否正常
3、配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# on the default devices.
blacklist {
devnode "^(ram|raw|loop|fd|md|dm-|sr|sr|scd|st)[0-9]*"
devnode "^hd[a-z]"
}
devices {
device {
vendor "HP"
path_grouping_policy multibus
features "1 queue_if_no_path"
path_checker readsector()
failback immediate
}
}<br><br>完整的配置如下:
blacklist {
devnode "^sda"
}
defaults {
user_friendly_names no
}
multipaths {
multipath {
wwid14945540000000000a67854c6270b4359c66c272e2f356321
alias iscsi-dm0
path_grouping_policymultibus
path_checkertur
path_selector "round-robin 0"
}
multipath {
wwid14945540000000000dcca2eda91d70b81edbcfce2357f99ee
alias iscsi-dm1
path_grouping_policymultibus
path_checkertur
path_selector "round-robin 0"
}
multipath {
wwid1494554000000000020f763489c165561101813333957ed96
alias iscsi-dm2
path_grouping_policymultibus
path_checkertur
path_selector "round-robin 0"
}
multipath {
wwid14945540000000000919ca813020a195422ba3663e1f03cc3
alias iscsi-dm3
path_grouping_policymultibus
path_checkertur
path_selector "round-robin 0"
}
}
devices {
device {
vendor "iSCSI-Enterprise"
product "Virtual disk"
path_grouping_policymultibus
getuid_callout "/sbin/scsi_id -g -u -s /block/%n"
path_checkerreadsector0
path_selector "round-robin 0"
}
}
4、命令
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
[root@web2 ~]# multipath -h
multipath-tools v0.4.7 (03/12, 2006)
Usage: multipath[-v level] [-d] [-h|-l|-ll|-f|-F|-r]
[-p failover|multibus|group_by_serial|group_by_prio]
[device]
-v levelverbosity level
0no output
1print created devmap names only
2default verbosity
3print debug information
-h print this usage text
-b file bindings file location
-d dry run, do not create or update devmaps
-l show multipath topology (sysfs and DM info)
-ll show multipath topology (maximum info)
-f flush a multipath device map
-F flush all multipath device maps
-r force devmap reload
-p policy force all maps to specified policy :
failover 1 path per priority group
multibus all paths in 1 priority group
group_by_serial 1 priority group per serial
group_by_prio1 priority group per priority lvl
group_by_node_name 1 priority group per target node
device limit scope to the device's multipath
(udev-style $DEVNAME reference, eg /dev/sdb
or major:minor or a device map name)
[root@web2 ~]#
5、启动关闭
1
2
3
4
# /etc/init.d/multipathd start #开启mulitipath服务
service multipath start
service multipath restart
service multipath shutdown
6、如何获取wwid
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
1、
[root@vxfs01 ~]# cat /var/lib/multipath/bindings
# Multipath bindings, Version : 1.0
# NOTE: this file is automatically maintained by the multipath program.
# You should not need to edit this file in normal circumstances.
#
# Format:
# alias wwid
#
mpath0 36006016051d50e0035744871c912de11
mpath1 36006016051d50e0034744871c912de11
mpath2 36006016051d50e0032744871c912de11
mpath3 36006016051d50e0039744871c912de11
mpath4 36006016051d50e003a744871c912de11
2、
[root@vxfs01 ~]# multipath -v3 |grep 3600
sdb: uid = 36006016051d50e003a744871c912de11 (callout)
sdc: uid = 36006016051d50e003a744871c912de11 (callout)
sdd: uid = 36006016051d50e003a744871c912de11 (callout)
sde: uid = 36006016051d50e003a744871c912de11 (callout)
36006016051d50e003a744871c912de11 1:0:0:0 sdb 8:16 0 [undef][ready] DGC,RAI
36006016051d50e003a744871c912de11 1:0:1:0 sdc 8:32 1 [undef][ready] DGC,RAI
36006016051d50e003a744871c912de11 2:0:0:0 sdd 8:48 1 [undef][ready] DGC,RAI
36006016051d50e003a744871c912de11 2:0:1:0 sde 8:64 0 [undef][ready] DGC,RAI
Found matching wwid [36006016051d50e003a744871c912de11] in bindings file.
比较详细的文字:
http://zhumeng8337797.blog.163.com/blog/static/1007689142013416111534352/
http://blog.csdn.net/wuweilong/article/details/14184097
RHEL官网资料:
http://www.prudentwoo.com/wp-content/uploads/downloads/2013/11/Red_Hat_Enterprise_Linux-5-DM_Multipath-en-US.pdf
http://www.prudentwoo.com/wp-content/uploads/downloads/2013/11/Red_Hat_Enterprise_Linux-5-DM_Multipath-zh-CN.pdf
http://www.prudentwoo.com/wp-content/uploads/downloads/2013/11/Red_Hat_Enterprise_Linux-6-DM_Multipath-en-US.pdf
http://www.prudentwoo.com/wp-content/uploads/downloads/2013/11/Red_Hat_Enterprise_Linux-6-DM_Multipath-zh-CN.pdf
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)