Ubuntu
如何將邏輯卷擴展到 100%?
我有驅動器 5GB。我通過命令sudo lvcreate -L +2GB -n lv-test vg-test創建了 pv,而不是 vg,並在邏輯卷大小為 2GB 之後 。比我格式化這個卷sudo mkfs.ext4 /dev/vg-test/lv-test並掛載它sudo mkdir -p /mnt/lv-test 現在我想將此邏輯卷擴展到 100%FREE(到所有大小的磁碟- 5GB)。但是當我lvextend 100%FREE /dev/vg-test/lv-test時,LV 只擴展了 1 GB。現在是 3GB。怎麼了?如何將其擴展到 5GB?
user@ubuntu2:~$ sudo pvdisplay --- Physical volume --- PV Name /dev/sdj VG Name vg-test PV Size 5.00 GiB / not usable 4.00 MiB Allocatable yes PE Size 4.00 MiB Total PE 1279 Free PE 512 Allocated PE 767 PV UUID N5fWom-E678-uzKn-c4Dt-ielb-57GN-9h2kfm user@ubuntu2:~$ sudo vgdisplay --- Volume group --- VG Name vg-test System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 3 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size <5.00 GiB PE Size 4.00 MiB Total PE 1279 Alloc PE / Size 767 / <3.00 GiB Free PE / Size 512 / 2.00 GiB VG UUID ZCjGyZ-n1Rs-bT8d-z0cg-k8fO-9d2J-Fonggh user@ubuntu2:~$ sudo lvdisplay --- Logical volume --- LV Path /dev/vg-test/lv-test LV Name lv-test VG Name vg-test LV UUID GYtquF-h2H7-Ys2k-ec9G-BH00-ToTj-NY2Vdo LV Write Access read/write LV Creation host, time ubuntu2, 2022-02-21 20:46:54 +0000 LV Status available # open 0 LV Size <3.00 GiB Current LE 767 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:2 user@ubuntu2:~$ sudo lvextend -l 100%FREE vg-test/lv-test New size given (512 extents) not larger than existing size (767 extents)
您想添加所有可用空間,因此需要
+
:lvextend -l +100%FREE /dev/vg-test/lv-test
沒有那個,你要求 LV 只佔用可用空間。