multipath多路径,Linux系统底层存储扩容了,如何扩大文件系统?

multipath多路径,Linux系统底层存储扩容了,如何扩大文件系统?,第1张

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空间

更新文件系统空间

Linux多路径指的是除了主机和硬盘一条路径的连接,还包括了主机和网络服务器的连接形成的主机一对多的路径连接关系。通过多路径的连接,实现了磁盘的虚拟化。

1、安装多路径软件包:

device-mapper-1.02.67-2.el5

device-mapper-event-1.02.67.2.el5

device-mapper-multipath-0.4.7-48.el5

[root@RKDB01 Server]# rpm -ivh device-mapper-1.02.67-2.el5.x86_64.rpm

warning: device-mapper-1.02.67-2.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing.。。 ########################################### [100%]

package device-mapper-1.02.67-2.el5.x86_64 is already installed

[root@RKDB01 Server]# rpm -ivh device-mapper-event-1.02.67-2.el5.x86_64.rpm

warning: device-mapper-event-1.02.67-2.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing.。。 ########################################### [100%]

package device-mapper-event-1.02.67-2.el5.x86_64 is already installed

[root@RKDB01 Server]# rpm -ivh device-mapper-multipath-0.4.7-48.el5.x86_64.rpm

warning: device-mapper-multipath-0.4.7-48.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing.。。 ########################################### [100%]

package device-mapper-multipath-0.4.7-48.el5.x86_64 is already installed

2、设置开机启动,并检查安装包是否正常:

chkconfig --level 345 multipathd on

lsmod |grep dm_multipath

[root@RKDB01 Server]# chkconfig --level 345 multipathd on

[root@RKDB01 Server]# 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

[root@RKDB01 Server]#

3、配置multipathd 使其正常工作,编辑/etc/multipath.conf,开放如下内容:

defaults {

udev_dir /dev

polling_interval 10

selector “round-robin 0”

path_grouping_policy multibus

getuid_callout “/sbin/scsi_id -g -u -s /block/%n”

prio_callout none

path_checker readsector0

rr_min_io 100

max_fds 8192

rr_weight priorities

failback immediate

no_path_retry fail

user_friendly_names yes

}

blacklist {

wwid 26353900f02796769

devnode “^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*”

devnode “^hd[a-z]”

}

4、并关闭如下内容

#blacklist {

# devnode “*”

#}

#defaults {

27 # user_friendly_names yes

28 #}

5、完成之后执行如下命令发现多路径:

[root@RKDB01 Server]# modprobe dm-multipath

[root@RKDB01 Server]# multipath -F

[root@RKDB01 Server]# multipath dm-multipath

[root@RKDB01 Server]# multipath dm-round-robin

[root@RKDB01 Server]# service multipathd restart

正在关闭multipathd 端口监控程序: [确定]

正在启动守护进程multipathd: [确定]

[root@RKDB01 Server]# multipath -v2

[root@RKDB01 Server]# multipath -v2

[root@RKDB01 Server]# multipath -ll

mpath1 (3600d02310000011b16a5d57c6a1bd99a) dm-0 TOYOU,NetStor_iSUM510

[size=3.3T][features=0][hwhandler=0][rw]

\_ round-robin 0 [prio=2][ena bled]

\_ 1:0:0:0 sdb 8:16 [failed][ready]

\_ 1:0:1:0 sdc 8:32 [failed][ready]

[root@RKDB01 Server]#

6、重启服务器后,可以看到多路径信息了:

[root@RKDB01 ~]# ll /dev/mapper/

总计 0

crw------- 1 root root 10, 60 11-05 22:35 control

brw-rw---- 1 root disk 253, 0 11-05 22:35 mpath1

brw-rw---- 1 root disk 253, 1 11-05 22:35 mpath2

[root@RKDB01 ~]# multipath -ll

mpath2 (3600d02310000011b76128b9c63138cf4) dm-1 TOYOU,NetStor_iSUM510

[size=3.2T][features=0][hwhandler=0][rw]

\_ round-robin 0 [prio=2][active]

\_ 1:0:0:1 sdc 8:32 [active][ready]

\_ 1:0:1:1 sde 8:64 [active][ready]

mpath1 (3600d02310000011b16a5d57c6a1bd99a) dm-0 TOYOU,NetStor_iSUM510

[size=20G][features=0][hwhandler=0][rw]

\_ round-robin 0 [prio=2][active]

\_ 1:0:0:0 sdb 8:16 [active][ready]

\_ 1:0:1:0 sdd 8:48 [active][ready]

7、通过fdisk 看可以生成了DM-0/DM-1两个盘,正是上面sdc/sde,sdb/sdd多路径后出来的:

[root@RKDB01 ~]# fdisk -l

Disk /dev/sda: 299.4 GB, 299439751168 bytes

255 heads, 63 sectors/track, 36404 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sda1 * 1 38 305203+ 83 Linux

/dev/sda2 39 13092 104856255 83 Linux

/dev/sda3 13093 19619 52428127+ 83 Linux

/dev/sda4 19620 36404 134825512+ 5 Extended

/dev/sda5 19620 26146 52428096 83 Linux

/dev/sda6 26147 28757 20972826 83 Linux

/dev/sda7 28758 30324 12586896 82 Linux swap / Solaris

/dev/sda8 30325 36404 48837568+ 83 Linux

Disk /dev/sdb: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn‘t contain a valid partition table

Disk /dev/sdc: 3568.4 GB, 3568429957120 bytes

255 heads, 63 sectors/track, 433836 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdc doesn’t contain a valid partition table

Disk /dev/sdd: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdd doesn‘t contain a valid partition table

Disk /dev/sde: 3568.4 GB, 3568429957120 bytes

255 heads, 63 sectors/track, 433836 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sde doesn’t contain a valid partition table

Disk /dev/dm-0: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-0 doesn‘t contain a valid partition table

Disk /dev/dm-1: 3568.4 GB, 3568429957120 bytes

255 heads, 63 sectors/track, 433836 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-1 doesn’t contain a valid partition table

Disk /dev/sdf: 4009 MB, 4009754624 bytes

255 heads, 63 sectors/track, 487 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sdf4 * 1 488 3915744+ b W95 FAT32

Partition 4 has different physical/logical endings:

phys=(486, 254, 63) logical=(487, 125, 22)

[root@RKDB01 ~]#

8、同时也可以在/dev/mapper目录中查看到多路径映射的信息:

[root@RKDB01 ~]# ll /dev/mapper/

总计 0

crw------- 1 root root 10, 60 11-06 00:49 control

brw-rw---- 1 root disk 253, 2 11-06 00:49 data-data001

brw-rw---- 1 root disk 253, 0 11-06 00:49 mpath1

brw-rw---- 1 root disk 253, 1 11-06 00:49 mpath2

1、打开SecureCRT,选择要登录的系统IP地址, 点击连接。

2、出现下图的界面说明连接成功。

3、然后我们使用cd 命名切换到要复制的文件所在的目录,比如说目录/123。

4、然后我们使用ls 命令列出文件夹里面的文件, 比如说目录123里面的123.txt 文件。

5、通过命令我们可以看到456目录里面是空的。

6、假如我们要把123.txt 复制到456文件夹里面,那么就使用命令cp 要复制的文件的路径 要复制到的文件夹路径,如下图所示,把123.txt 复制到456文件夹 ,然后ls 查看已经复制成功了。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/7096473.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-01
下一篇 2023-04-01

发表评论

登录后才能评论

评论列表(0条)

保存