[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.添加硬盘。
2,查看分区。
[root@mediawiki ~]# df -TH
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos_mediawiki-root xfs 40G 2.9G 37G 8% /
devtmpfs devtmpfs 1.1G 0 1.1G 0% /dev
tmpfs tmpfs 1.1G 0 1.1G 0% /dev/shm
tmpfs tmpfs 1.1G 11M 1.1G 1% /run
tmpfs tmpfs 1.1G 0 1.1G 0% /sys/fs/cgroup
/dev/sda1 xfs 1.1G 139M 926M 13% /boot
tmpfs tmpfs 208M 0 208M 0% /run/user/0 3,查看添加的硬盘。
[root@mediawiki ~]# fdisk -l
Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes 4,创建物理卷,将新增磁盘加入到物理卷。
[root@mediawiki ~]# pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created. 5,查看物理卷信息。