$ sudo vgdisplay --- Volume group --- VG Name ubuntu-vg System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 2 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 1 Max PV 0 Cur PV 1 Act PV 1 VG Size <98.00 GiB PE Size 4.00 MiB Total PE 25087 Alloc PE / Size 12543 / <49.00 GiB Free PE / Size 12544 / 49.00 GiB VG UUID yXGbkZ-Df4M-MHt2-rEPb-qLZB-4CKW-EGA7ic
再看下逻辑卷信息:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
$ sudo lvdisplay --- Logical volume --- LV Path /dev/ubuntu-vg/ubuntu-lv LV Name ubuntu-lv VG Name ubuntu-vg LV UUID R9z0zw-JgyS-c38B-xcvu-YSEA-T8PR-fVjjuL LV Write Access read/write LV Creation host, time ubuntu-server, 2024-03-25 05:25:36 +0000 LV Status available # open 1 LV Size <49.00 GiB Current LE 12543 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0
$ sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv Size of logical volume ubuntu-vg/ubuntu-lv changed from <49.00 GiB (12543 extents) to <98.00 GiB (25087 extents). Logical volume ubuntu-vg/ubuntu-lv successfully resized.
最后执行:
1
sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
输出:
1 2 3 4 5
$ sudo resize2fs /dev/ubuntu-vg/ubuntu-lv resize2fs 1.46.5 (30-Dec-2021) Filesystem at /dev/ubuntu-vg/ubuntu-lv is mounted on /; on-line resizing required old_desc_blocks = 7, new_desc_blocks = 13 The filesystem on /dev/ubuntu-vg/ubuntu-lv is now 25689088 (4k) blocks long.