--- Physical volume --- PV Name /dev/sda3 VG Name Xeon-vg PV Size 55.16 GiB / not usable 4.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 14120 Free PE 0 Allocated PE 14120 PV UUID lHbbtD-GhR7-5Ie9-OQnQ-9IYE-Y0cV-HDdZtZ
--- Volume group --- VG Name Xeon-vg System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 6 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 1 Act PV 1 VG Size 55.16 GiB PE Size 4.00 MiB Total PE 14120 Alloc PE / Size 14120 / 55.16 GiB Free PE / Size 0 / 0 VG UUID Wbc0FF-M7HR-Rzgf-4wf2-oNjB-J2KT-1Kwp0Z
--- Logical volume --- LV Path /dev/Xeon-vg/root LV Name root VG Name Xeon-vg LV UUID TO99bO-91qT-Zqeu-SsJ0-jFMo-30Kn-oVtGqd LV Write Access read/write LV Creation host, time Xeon, 2017-02-27 07:01:36 +0800 LV Status available # open 1 LV Size 54.16 GiB Current LE 13866 Segments 2 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 252:0 --- Logical volume --- LV Path /dev/Xeon-vg/swap_1 LV Name swap_1 VG Name Xeon-vg LV UUID Ig7xvr-scZ3-Opqe-d1Ww-Z0aT-I4B1-9h2sD4 LV Write Access read/write LV Creation host, time Xeon, 2017-02-27 07:01:36 +0800 LV Status available # open 2 LV Size 1016.00 MiB Current LE 254 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 252:1
WARNING: Reducing active logical volume to 512.00 MiB THIS MAY DESTROY YOUR DATA (filesystem etc.) Do you really want to reduce swap_1? [y/n]: y Reducing logical volume swap_1 to 512.00 MiB Logical volume swap_1 successfully resized
# mkswap /dev/Xeon-vg/swap_1 mkswap: /dev/Xeon-vg/swap_1: warning: don't erase bootbits sectors on whole disk. Use -f to force. Setting up swapspace version 1, size = 524284 KiB no label, UUID=142b1c26-9e3f-45c4-afff-b0cce3c9448e
--- Volume group --- VG Name Xeon-vg System ID Format lvm2 Metadata Areas 1 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 1 Act PV 1 VG Size 55.16 GiB PE Size 4.00 MiB Total PE 14120 Alloc PE / Size 13994 / 54.66 GiB Free PE / Size 126 / 504.00 MiB VG UUID Wbc0FF-M7HR-Rzgf-4wf2-oNjB-J2KT-1Kwp0Z
注意其中的Free PE / Size,可以看到还有504M的未分配闲置空间,下一步就是要把这部分空间扩展到root逻辑卷中。
resize2fs 1.42.9 (4-Feb-2014) Filesystem at /dev/Xeon-vg/root is mounted on /; on-line resizing required old_desc_blocks = 4, new_desc_blocks = 4 The filesystem on /dev/Xeon-vg/root is now 14327808 blocks long.