这里扩展:/dev/mapper/ubuntu--vg-ubuntu--lv
bash
root@book:/data# df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 795M 1.2M 794M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 48G 11G 35G 24% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/loop1 50M 50M 0 100% /snap/snapd/18357
/dev/loop2 41M 41M 0 100% /snap/snapd/19993
/dev/loop0 64M 64M 0 100% /snap/core20/1828
/dev/loop4 64M 64M 0 100% /snap/core20/2015
/dev/loop3 92M 92M 0 100% /snap/lxd/24061
/dev/sda2 2.0G 209M 1.6G 12% /boot
tmpfs 795M 0 795M 0% /run/user/0
root@book:/data# 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 Mk5zlb-zqJO-3KgW-FbJ0-Q253-8msJ-0sGMYy
root@book:/data# df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 795M 1.2M 794M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 48G 11G 35G 24% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/loop1 50M 50M 0 100% /snap/snapd/18357
/dev/loop2 41M 41M 0 100% /snap/snapd/19993
/dev/loop0 64M 64M 0 100% /snap/core20/1828
/dev/loop4 64M 64M 0 100% /snap/core20/2015
/dev/loop3 92M 92M 0 100% /snap/lxd/24061
/dev/sda2 2.0G 209M 1.6G 12% /boot
tmpfs 795M 0 795M 0% /run/user/0
root@book:/data# sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
Size of logical volume ubuntu-vg/ubuntu-lv changed from <49.00 GiB (12543 exte nts) to <98.00 GiB (25087 extents).
Logical volume ubuntu-vg/ubuntu-lv successfully resized.
root@book:/data# df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 795M 1.2M 794M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 48G 11G 35G 24% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/loop1 50M 50M 0 100% /snap/snapd/18357
/dev/loop2 41M 41M 0 100% /snap/snapd/19993
/dev/loop0 64M 64M 0 100% /snap/core20/1828
/dev/loop4 64M 64M 0 100% /snap/core20/2015
/dev/loop3 92M 92M 0 100% /snap/lxd/24061
/dev/sda2 2.0G 209M 1.6G 12% /boot
tmpfs 795M 0 795M 0% /run/user/0
root@book:/data# sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizin g required
old_desc_blocks = 7, new_desc_blocks = 13
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 25689088 (4k) blocks long.
root@book:/data# df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 795M 1.2M 794M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 97G 11G 82G 12% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/loop1 50M 50M 0 100% /snap/snapd/18357
/dev/loop2 41M 41M 0 100% /snap/snapd/19993
/dev/loop0 64M 64M 0 100% /snap/core20/1828
/dev/loop4 64M 64M 0 100% /snap/core20/2015
/dev/loop3 92M 92M 0 100% /snap/lxd/24061
/dev/sda2 2.0G 209M 1.6G 12% /boot
tmpfs 795M 0 795M 0% /run/user/0