1、需要扩容的LV为LV01,扩容容量+100GB
[root@yunwei /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 292G 3.3G 289G 2% /
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 2.0G 8.9M 2.0G 1% /run
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sda1 497M 154M 344M 31% /boot
tmpfs 395M 32K 395M 1% /run/user/0
/dev/mapper/VG01-LV01 149G 3.1G 146G 3% /test
2、查看LV大小,LV01大小为149G
[root@yunwei /]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
LV01 VG01 -wi-ao---- 149.00g
root rhel -wi-ao---- 291.69g
swap rhel -wi-ao---- 7.81g
[root@yunwei /]#
3、查看VG大小,VG01剩余空间为50G,不满足扩容要求
[root@yunwei /]# vgs
VG #PV #LV #SN Attr VSize VFree
VG01 2 1 0 wz--n- 199.99g 50.99g
rhel 2 2 0 wz--n- 299.50g 0
[root@yunwei /]#
4、格式化新添加的磁盘
[root@yunwei /]# mkfs.xfs /dev/vdc1
meta-data=/dev/vdc1 isize=512 agcount=4, agsize=6553536 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=26214144, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=12799, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@yunwei /]#
5、创建PV
[root@yunwei /]# pvcreate /dev/vdc1
WARNING: xfs signature detected on /dev/vdc1 at offset 0. Wipe it? [y/n]: y
Wiping xfs signature on /dev/vdc1.
Physical volume "/dev/vdc1" successfully created.
[root@yunwei /]#
6、VG扩容和查看
[root@yunwei /]# vgextend VG01 /dev/vdc1
Volume group "VG01" successfully extended
[root@yunwei /]# vgs
VG #PV #LV #SN Attr VSize VFree
VG01 3 1 0 wz--n- <299.99g <150.99g
rhel 2 2 0 wz--n- 299.50g 0
[root@yunwei /]#
7、LV扩容和查看
[root@yunwei /]# lvextend -L +100GB /dev/VG01/LV01
Size of logical volume VG01/LV01 changed from 149.00 GiB (38144 extents) to 249.00 GiB (63744 extents).
Logical volume VG01/LV01 successfully resized.
[root@yunwei /]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
LV01 VG01 -wi-ao---- 249.00g
root rhel -wi-ao---- 291.69g
swap rhel -wi-ao---- 7.81g
[root@yunwei /]#
8、查看df -h 查看容量变化,发现没有变化
[root@yunwei /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 292G 3.3G 289G 2% /
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 2.0G 8.9M 2.0G 1% /run
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sda1 497M 154M 344M 31% /boot
tmpfs 395M 32K 395M 1% /run/user/0
/dev/mapper/VG01-LV01 149G 3.1G 146G 3% /test
[root@yunwei /]#
9、使用xfs_growfs同步磁盘信息
[root@yunwei /]# xfs_growfs /dev/mapper/VG01-LV01
meta-data=/dev/mapper/VG01-LV01 isize=512 agcount=7, agsize=6488064 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=39059456, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=12672, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 39059456 to 65273856
[root@yunwei /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 292G 3.3G 289G 2% /
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 2.0G 8.9M 2.0G 1% /run
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sda1 497M 154M 344M 31% /boot
tmpfs 395M 32K 395M 1% /run/user/0
/dev/mapper/VG01-LV01 249G 3.1G 246G 2% /test
[root@yunwei /]#
喜欢我的文章,可以关注我的微信公众号
运维少年
哦!
网友评论