![LVM 调整大小失败](https://linux22.com/image/783293/LVM%20%E8%B0%83%E6%95%B4%E5%A4%A7%E5%B0%8F%E5%A4%B1%E8%B4%A5.png)
概括
我尝试使用 LVM 扩展分区,但失败了... 所有 Google 和 Bing 搜索都失败了,所以不确定问题出在哪里。以下是目前发生的情况。
这是一台虚拟服务器,拥有 8GB 的存储空间。应用该应用程序后,存储空间已达到上限(更新和下载期间空间不足)。它只需要 4GB 的存储空间,因此应用了 4GB(VirtIO)。操作系统检测到了这一点,我使用 fdisk 将 VDA3 从 8GB 扩展到 12GB,但 LVM 不会扩展。
原始版本(6.2G 完整版)
admin@host:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 63.3M 1 loop /snap/core20/1778
loop1 7:1 0 63.2M 1 loop /snap/core20/1738
loop2 7:2 0 79.9M 1 loop /snap/lxd/22923
loop3 7:3 0 103M 1 loop /snap/lxd/23541
loop4 7:4 0 49.6M 1 loop /snap/snapd/17883
loop5 7:5 0 49.8M 1 loop /snap/snapd/17950
vda 252:0 0 12G 0 disk
├─vda1 252:1 0 1M 0 part
├─vda2 252:2 0 1.8G 0 part /boot
└─vda3 252:3 0 6.2G 0 part
└─ubuntu--vg-ubuntu--lv 253:0 0 6.2G 0 lvm /
分割
sudo fdisk /dev/vda
command: p
command: d, 3
command: n, 3, #default, #default, n
command: w
新输出(VDA3 上为 10.2GB,而非 LVM)
admin@host:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 63.3M 1 loop /snap/core20/1778
loop1 7:1 0 79.9M 1 loop /snap/lxd/22923
loop2 7:2 0 49.6M 1 loop /snap/snapd/17883
loop3 7:3 0 49.8M 1 loop /snap/snapd/17950
loop4 7:4 0 103M 1 loop /snap/lxd/23541
loop5 7:5 0 63.2M 1 loop /snap/core20/1738
vda 252:0 0 12G 0 disk
├─vda1 252:1 0 1M 0 part
├─vda2 252:2 0 1.8G 0 part /boot
└─vda3 252:3 0 10.2G 0 part
└─ubuntu--vg-ubuntu--lv 253:0 0 6.2G 0 lvm /
admin@host:~$ 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 <6.25 GiB
PE Size 4.00 MiB
Total PE 1599
Alloc PE / Size 1599 / <6.25 GiB
Free PE / Size 0 / 0
VG UUID o7ksYe-qxbY-CmVj-A5le-qjG0-IYQt-aQgzlB
问题
这就是我被困住的地方。我研究过的所有指南、帖子和论坛都失败了。我假设在某个时候它应该显示 FREE PE / Size 应该被检测到,但什么也没有放弃分区中的额外空间。
尝试
rebooting | nothing changes.
partprobe | nothing changes.
resize2fs /dev/vda3 | error:
- resize2fs 1.46.5 (30-Dec-2021)
- resize2fs: Device or resource busy while trying to open /dev/vda3
- Couldn't find valid filesystem superblock.
Note: This is supposed to be the next step after the partition resize (from my guidance when starting this). I also attempted to do it on the LVM and got "The filesystem is already 1637376 (4k) blocks long. Nothing to do!"
sudo lvextend -r -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv | Error: /etc/lvm/archive/.lvm_host_3409_915866633: write error failed: No space left on device
sudo pvresize /dev/vda3
/etc/lvm/archive/.lvm_host_10938_2037765275: write error failed: No space left on device
0 physical volume(s) resized or updated / 1 physical volume(s) not resized
我对 Linux 并不陌生,但远算不上专业人士……在此先感谢所有阅读并提供帮助的人:3
// 请求的输出
admin@host:~$ sudo lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
ubuntu-lv ubuntu-vg -wi-ao---- <6.25g