逻辑卷调整大小后卡在 initramfs 中,未找到卷组

逻辑卷调整大小后卡在 initramfs 中,未找到卷组

希望有人能帮助我恢复我的 ubuntu 服务器实例。虚拟机空间不足,我决定扩展虚拟磁盘。

lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
  Size of logical volume ubuntu-vg/ubuntu-lv changed from 37.00 GiB (9472 extents) to <74.00 GiB (18943 extents).
  Logical volume ubuntu-vg/ubuntu-lv successfully resized.

我注意到这个方法有效,但只到 75GB,所以我意识到我仍然需要增加分区大小,如下所示:

sudo growpart /dev/xvda 3
CHANGED: partition=3 start=2101248 old: size=155183104 end=157284352 new: size=417329119 end=419430367

然后我想我可以返回并再次运行原始命令,因为 lsblk 返回下面这个结果,这对我来说看起来很好:

lsblk
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0                       7:0    0 55.5M  1 loop /snap/core18/2246
loop1                       7:1    0 55.5M  1 loop /snap/core18/2253
loop2                       7:2    0 61.9M  1 loop /snap/core20/1242
loop3                       7:3    0 61.9M  1 loop /snap/core20/1270
loop4                       7:4    0 67.2M  1 loop /snap/lxd/21803
loop5                       7:5    0 67.2M  1 loop /snap/lxd/21835
loop6                       7:6    0 42.2M  1 loop /snap/snapd/14066
loop7                       7:7    0 43.3M  1 loop /snap/snapd/14295
sr0                        11:0    1 1024M  0 rom
xvda                      202:0    0  200G  0 disk
├─xvda1                   202:1    0    1M  0 part
├─xvda2                   202:2    0    1G  0 part /boot
└─xvda3                   202:3    0  199G  0 part
  └─ubuntu--vg-ubuntu--lv 253:0    0   74G  0 lvm  /
xvdb                      202:16   0  5.4T  0 disk
└─xvdb1                   202:17   0  5.4T  0 part /mnt/media

于是再次执行lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv但是遇到了这个错误:

user@server:~$ sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
  Volume group "ubuntu-vg" not found
  Cannot process volume group ubuntu-vg

我最终放弃了,因为一切都正常,而且我增加了空间以满足一段时间的需要,但我认为我稍后会再回来...我在重新启动之前没有这样做,现在我被困在 initramfs 中,在启动时出现类似这样的错误,类似于我尝试扩展卷时遇到的错误:

Volume group "ubuntu-vg" not found
Cannot process volume group ubuntu-vg
...
    ALERT!  /dev/mapper/ubuntu--vg-ubuntu--lv does not exist. Dropping to a shell!

其他说明

回顾我所做的事情,我担心这可能是一个问题:

sudo fdisk -u /dev/mapper/ubuntu--vg-ubuntu--lv

Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

The old ext4 signature will be removed by a write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xaae0d62a.

Command (m for help): p
Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 73.102 GiB, 79452700672 bytes, 155181056 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xaae0d62a

Command (m for help): w
The partition table has been altered.
Syncing disks.

只是觉得上面的警告意味着某些东西需要更新,所以只是随意地对该磁盘和下面的磁盘进行了更新:

sudo fdisk /dev/xvda3

Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

The old LVM2_member signature will be removed by a write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xfc8b2324.

Command (m for help): p
Disk /dev/xvda3: 73.102 GiB, 79453749248 bytes, 155183104 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xfc8b2324

Command (m for help): w
The partition table has been altered.
Syncing disks.

现在我被困在这个 initramfs shell 中,希望有人能帮助我修复这个问题而不用重建整个系统...我可能错过了一些问题和部分,但我尽可能地解释了可能出了什么问题,只是希望这可能是一件容易撤消的事情?

相关内容