1、查看现在硬盘情况
root@ubuntu:~# df -h Filesystem Size Used Avail Use% Mounted on tmpfs 1.6G 1.1M 1.6G 1% /run efivarfs 256K 64K 188K 26% /sys/firmware/efi/efivars /dev/mapper/ubuntu--vg-ubuntu--lv 48G 6.4G 39G 15% / tmpfs 7.9G 0 7.9G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock /dev/sda2 2.0G 96M 1.7G 6% /boot /dev/sda1 1.1G 6.2M 1.1G 1% /boot/efi tmpfs 1.6G 12K 1.6G 1% /run/user/0
安装时给了100G的空间,现在只使用了50G,剩下的还处于空间状态。
2、通过 vgdisplay 查看一下具体剩余空间
root@ubuntu:~# 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 <96.95 GiB PE Size 4.00 MiB Total PE 24818 Alloc PE / Size 12409 / 48.47 GiB Free PE / Size 12409 / 48.47 GiB VG UUID O814Hq-CEoa-S0E4-Vl40-bNre-XJV4-cOdaSv
红色文字部分,显示剩余空间:48.47G
3、将全部剩余空间扩容给逻辑卷
root@ubuntu:~# lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv Size of logical volume ubuntu-vg/ubuntu-lv changed from 48.47 GiB (12409 extents) to <96.95 GiB (24818 extents). Logical volume ubuntu-vg/ubuntu-lv successfully resized.
root@ubuntu:~# resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv resize2fs 1.47.0 (5-Feb-2023) Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required old_desc_blocks = 7, new_desc_blocks = 13 The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 25413632 (4k) blocks long.
4、查看扩容后的新空间情况
root@ubuntu:~# df -h Filesystem Size Used Avail Use% Mounted on tmpfs 1.6G 1.1M 1.6G 1% /run efivarfs 256K 64K 188K 26% /sys/firmware/efi/efivars /dev/mapper/ubuntu--vg-ubuntu--lv 96G 6.4G 85G 8% / tmpfs 7.9G 0 7.9G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock /dev/sda2 2.0G 96M 1.7G 6% /boot /dev/sda1 1.1G 6.2M 1.1G 1% /boot/efi tmpfs 1.6G 12K 1.6G 1% /run/user/0
标签:1.6,vg,--,ubuntu24.04,dev,ubuntu,硬盘空间,tmpfs,安装 From: https://www.cnblogs.com/hunttown/p/18510041