root@server1804:~# resize2fs -p -F /dev/mapper/ubuntu--vg-ubuntu--lv resize2fs 1.44.1 (24-Mar-2018) Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required old_desc_blocks = 1, new_desc_blocks = 2 The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 2621440 (4k) blocks long.
root@server1804:~#
扩容
增加到10G:lvextend -L 10G /dev/ubuntu-vg/ubuntu-lv
增加10G:lvextend -L +10G /dev/ubuntu-vg/ubuntu-lv
1 2 3 4
root@server1804:~# lvextend -L 10G /dev/ubuntu-vg/ubuntu-lv Size of logical volume ubuntu-vg/ubuntu-lv changed from 4.00 GiB (1024 extents) to 10.00 GiB (2560 extents). Logical volume ubuntu-vg/ubuntu-lv successfully resized. root@server1804:~#
减少
减少到10G:lvextend -L 10G /dev/ubuntu-vg/ubuntu-lv
减少10G:lvextend -L -10G /dev/ubuntu-vg/ubuntu-lv
1 2 3 4 5 6 7
root@server1804:~# lvreduce -L -1G /dev/ubuntu-vg/ubuntu-lv WARNING: Reducing active and open logical volume to 10.00 GiB. THIS MAY DESTROY YOUR DATA (filesystem etc.) Do you really want to reduce ubuntu-vg/ubuntu-lv? [y/n]: y Size of logical volume ubuntu-vg/ubuntu-lv changed from 11.00 GiB (2816 extents) to 10.00 GiB (2560 extents). Logical volume ubuntu-vg/ubuntu-lv successfully resized. root@server1804:~#