[root@localnat201 ~]# vgextend myvg /dev/sdc
Volume group "myvg" successfully extended
[root@localnat201 ~]# vgdisplay
--- Volume group ---
VG Name cl
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size <29.00 GiB
PE Size 4.00 MiB
Total PE 7423
Alloc PE / Size 7422 / 28.99 GiB
Free PE / Size 1 / 4.00 MiB
VG UUID EZIlfD-2r61-x8RC-qLwl-Nsqp-D5zr-J8pPfI
--- Volume group ---
VG Name myvg
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 39.99 GiB
PE Size 4.00 MiB
Total PE 10238
Alloc PE / Size 5119 / <20.00 GiB
Free PE / Size 5119 / <20.00 GiB
VG UUID dVW1W5-AMKN-xMEy-TGBs-QRF7-Nvvs-ZnFpLd
我们可以看到VG扩充成功,并且已经有了5119PE的自由空间。现在我们就可以使用这个剩余空间扩充逻辑卷了,这里我们可以使用 lvextend 命令扩充逻辑卷:
[root@localnat201 ~]# lvextend -l +5119 /dev/myvg/mylv
Size of logical volume myvg/mylv changed from <20.00 GiB (5119 extents) to 39.99 GiB (10238 extents).
Logical volume myvg/mylv successfully resized.
[root@localnat201 ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root cl -wi-ao---- 26.99g
swap cl -wi-ao---- 2.00g
mylv myvg -wi-a----- 39.99g
[root@localnat201 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
cl 1 2 0 wz--n- <29.00g 4.00m
myvg 2 1 0 wz--n- 39.99g 0
[root@localnat201 ~]# df -lh
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/cl-root 27G 5.6G 22G 21% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 8.6M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 1014M 186M 829M 19% /boot
tmpfs 378M 0 378M 0% /run/user/0
/dev/mapper/myvg-mylv 20G 33M 19.9G 1% /data