建立實體卷
新添加擴容磁盤/dev/vdb2
[[email protected] ~]# pvcreate /dev/vdb2
WARNING: ext4 signature detected on /dev/vdb2 at offset 1080. Wipe it? [y/n]: y
Wiping ext4 signature on /dev/vdb2.
Physical volume "/dev/vdb2" successfully created
擴容vg卷組
- 先檢視卷組名
[[email protected] ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 3 2 0 wz--n- 339.50g 0
或者
[[email protected] ~]# vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 7
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 3
Act PV 3
VG Size 339.50 GiB
PE Size 4.00 MiB
Total PE 86912
Alloc PE / Size 86912 / 339.50 GiB
Free PE / Size 0 / 0
VG UUID 97wfoc-ySPX-dGIQ-MZMv-6gVQ-aD7A-arVelO
- 然後擴容vg
[[email protected] ~]# vgextend centos /dev/vdb2
Volume group "centos" successfully extended
[[email protected] ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 3 2 0 wz--n- 339.50g 300.00g
擴容lv
[[email protected] ~]# lvextend -L +300G /dev/centos/root
Size of logical volume centos/root changed from 38.50 GiB (9856 extents) to 338.50 GiB (86656 extents).
Logical volume root successfully resized
擴充檔案系統
xfs_growfs /dev/centos/root //xfs_growfs 針對 xfs檔案系統
resize2fs //針對ext2/ext3/ext4檔案系統
檢視系統盤 已經擴容完畢
40G,擴容了300G
[[email protected] ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 339G 31G 308G 10% /
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 375M 3.5G 10% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/vda1 497M 155M 343M 32% /boot