创建物理卷
新添加扩容磁盘/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