[root@Template ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name vg_template
PV Size 39.51 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 10114
Free PE 0
Allocated PE 10114
PV UUID A6Ai9a-LdqF-GbCn-p0DF-3V3X-j3h1-KfvlI4
"/dev/sdb" is a new physical volume of "20.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb
VG Name
PV Size 20.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID sxgFvu-x0au-8CxD-g6I6-yCJe-M9gg-Ax2jiu 7,扩展卷组vg_template,即将PV加入卷组(VG)。
[root@Template ~]# vgextend vg_template /dev/sdb
Volume group "vg_template" successfully extended 8,先查看vg信息,然后将原/dev/vg_template/lv_root 逻辑卷的大小增加。
[root@Template ~]# vgdisplay
--- Volume group ---
VG Name vg_template
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 59.50 GiB
PE Size 4.00 MiB
Total PE 15233
Alloc PE / Size 10114 / 39.51 GiB
Free PE / Size 5119 / 20.00 GiB
VG UUID p5VnUJ-vdh9-7ffb-guxI-97sR-GnzU-rwzyc4 9,运行扩容命令,对/dev/vg_template/lv_root逻辑卷进行扩容(可能是虚拟机的问题,+20GB提示空间超了)。
[root@Template vg_template]# lvextend -l +100%FREE /dev/mapper/vg_template-lv_root 10,然后运行resize2fs命令 对容量重新扩容。
[root@Template vg_template]# resize2fs /dev/mapper/vg_template-lv_root 11,查看空间是否增大。
[root@Template vg_template]# df -TH 二、在虚拟机上操作模拟实验步骤(Centos7.5扩展LVM卷)
1.添加硬盘。