环境:
OS:Centos 7
1.控制台添加云盘
2.创建pv
pvcreate /dev/sdc
3.扩充VG
[root@19c ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 2 2 0 wz--n- 42.99g 0
[root@19c ~]# vgextend centos /dev/sdc
Volume group "centos" successfully extended
4.扩充LV
[root@19c ~]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID 1s5Iwx-Zr4D-H6Xa-z8wu-VVIC-F7EJ-VkIrxh
LV Write Access read/write
LV Creation host, time 19c, 2023-02-13 02:18:05 -0500
LV Status available
# open 2
LV Size 4.00 GiB
Current LE 1024
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID AQS4Y1-D6Pn-pGmL-0JUb-KCs5-w8dk-WEulby
LV Write Access read/write
LV Creation host, time 19c, 2023-02-13 02:18:06 -0500
LV Status available
# open 1
LV Size 38.99 GiB
Current LE 9982
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
[root@19c ~]# lvresize -l +100%FREE /dev/centos/root
Size of logical volume centos/root changed from 38.99 GiB (9982 extents) to <42.99 GiB (11005 extents).
Logical volume centos/root successfully resized.
5.扩充文件系统
[root@19c ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 2.9G 0 2.9G 0% /dev
tmpfs 2.9G 0 2.9G 0% /dev/shm
tmpfs 2.9G 9.0M 2.9G 1% /run
tmpfs 2.9G 0 2.9G 0% /sys/fs/cgroup
/dev/mapper/centos-root 39G 28G 12G 70% /
/dev/sda1 1014M 161M 854M 16% /boot
tmpfs 581M 0 581M 0% /run/user/0
[root@19c ~]# xfs_growfs /
meta-data=/dev/mapper/centos-root isize=512 agcount=5, agsize=2293504 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=10221568, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=4479, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 10221568 to 11269120