我正在尝试将我的 lvm 分区从 29GB 调整到 ~60GB。以下是我的当前状态:
root@demo:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 99M 1 loop /snap/core/11081
loop1 7:1 0 99.2M 1 loop /snap/core/11167
loop2 7:2 0 55.4M 1 loop /snap/core18/2066
loop3 7:3 0 55.5M 1 loop /snap/core18/1997
loop4 7:4 0 125.9M 1 loop /snap/docker/471
loop5 7:5 0 131.6M 1 loop /snap/docker/796
loop6 7:6 0 70.4M 1 loop /snap/lxd/19647
loop7 7:7 0 32.1M 1 loop /snap/snapd/12057
loop8 7:8 0 32.1M 1 loop /snap/snapd/11841
loop9 7:9 0 67.6M 1 loop /snap/lxd/20326
sr0 11:0 1 1024M 0 rom
vda 252:0 0 60G 0 disk
├─vda1 252:1 0 1M 0 part
├─vda2 252:2 0 1G 0 part /boot
└─vda3 252:3 0 59G 0 part
└─ubuntu--vg-ubuntu--lv 253:0 0 29G 0 lvm /
如您所见,我的 vda3 是 59G,我的 lvm 是 29G。当我运行以下命令时,我无法将 lvm 的大小调整为 ~59G。
root@demo:~# lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
New size (7423 extents) matches existing size (7423 extents).
root@demo:~# resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
resize2fs 1.45.5 (07-Jan-2020)
The filesystem is already 7601152 (4k) blocks long. Nothing to do!
root@demo:~#
我该如何修复它?
后续编辑:
root@demo:~# vgs
VG #PV #LV #SN Attr VSize VFree
ubuntu-vg 1 1 0 wz--n- <29.00g 0
答案1
显然它适用于:
root@demo:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 99M 1 loop /snap/core/11081
loop1 7:1 0 99.2M 1 loop /snap/core/11167
loop2 7:2 0 55.4M 1 loop /snap/core18/2066
loop3 7:3 0 55.5M 1 loop /snap/core18/1997
loop4 7:4 0 125.9M 1 loop /snap/docker/471
loop5 7:5 0 131.6M 1 loop /snap/docker/796
loop6 7:6 0 70.4M 1 loop /snap/lxd/19647
loop7 7:7 0 32.1M 1 loop /snap/snapd/12057
loop8 7:8 0 32.1M 1 loop /snap/snapd/11841
loop9 7:9 0 67.6M 1 loop /snap/lxd/20326
sr0 11:0 1 1024M 0 rom
vda 252:0 0 60G 0 disk
├─vda1 252:1 0 1M 0 part
├─vda2 252:2 0 1G 0 part /boot
└─vda3 252:3 0 59G 0 part
└─ubuntu--vg-ubuntu--lv 253:0 0 29G 0 lvm /
root@demo:~# pvresize /dev/vda3
Physical volume "/dev/vda3" changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized
root@demo:~# vgs
VG #PV #LV #SN Attr VSize VFree
ubuntu-vg 1 1 0 wz--n- <59.00g 30.00g
root@demo:~# lvextend -r -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv