luks 加密磁盘上基于 KVM 磁盘的虚拟机

luks 加密磁盘上基于 KVM 磁盘的虚拟机

我有一个运行 Windows 10 基于磁盘的 VM 的 Arch Linux。该磁盘位于不同的卷组上并且经过 luks 加密。我为每个具有 ext4 文件系统的虚拟机都有一个逻辑卷。我使用正确的 UUID 手动编辑了 fstab,并将类型设置为 ext4。在虚拟机上安装 Windows 之前,我重新启动以确保 fstab 已正确配置。安装后,在正确输入磁盘密码后,每个分区都会收到此错误:

[TIME] Timed out waiting for device /dev/disk/by-uuid/1bdc0382-d2a4-4581-b737-feec147dec40.
[DEPEND] Dependency failed for /disk0.
[DEPEND] Dependency failed for Local File Systems.
[DEPEND] Dependency failed for File System Check on /dev/disk/by-uuid/1bdc0382-d2a4-4581-b737-feec147dec40.

在这些错误之后我得到:

You are in emergency mode. After logging in type [...]

我不是 Linux 专家,所以答案可能比看起来更简单。有人有什么建议吗?

编辑#1:

系统表片段:

# /dev/mapper/volgroup0-lv_disk0
UUID=1bdc0382-d2a4-4581-b737-feec147dec40   /disk0  ext4    rw,relatime 0 2

编辑#2:

lsblk-f片段:

NAME                FSTYPE      FSVER            LABEL       UUID                                   FSAVAIL FSUSE% MOUNTPOINTS
sda                                                                                                                
`-sda1              crypto_LUKS 2                            48bd9c70-c5cd-42c0-a58e-f0257be18d44
  `-disk            LVM2_member LVM2 001                     IVCIiW-5r2w-AzHY-hWyE-iJ7g-IqPB-lUdP9o
    |-volgroup0-lv_disk0
    |                                                                                                              
    `-volgroup0-lv_disk1

黑子片段:

/dev/sda1: UUID="48bd9c70-c5cd-42c0-a58e-f0257be18d44" TYPE="crypto_LUKS" PARTUUID="fe7085b2-c19b-1f48-908c-c59dd96bcfc9"
/dev/mapper/disk: UUID="IVCIiW-5r2w-AzHY-hWyE-iJ7g-IqPB-lUdP9o" TYPE="LVM2_member"
/dev/mapper/volgroup0-lv_disk0: PTUUID="3421c065-23d3-48a1-8274-951444ce8d5c" PTTYPE="gpt"

编辑#3:

fdisk -l片段:

Disk /dev/mapper/disk: 447.12 GiB, 480086138368 bytes, 937668239 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
The primary GPT table is corrupt, but the backup appears OK, so that will be used.

Disk /dev/mapper/volgroup0-lv_disk0: 200 GiB, 214748364800 bytes, 419430400 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: gpt
Disk identifier: 3421C065-23D3-48A1-8274-951444CE8D5C

Device                                   Start       End   Sectors   Size Type
/dev/mapper/volgroup0-lv_disk0-part1      2048    206847    204800   100M EFI System
/dev/mapper/volgroup0-lv_disk0-part2    206848    239615     32768    16M Microsoft reserved
/dev/mapper/volgroup0-lv_disk0-part3    239616 418403031 418163416 199.4G Microsoft basic data
/dev/mapper/volgroup0-lv_disk0-part4 418404352 419426303   1021952   499M Windows recovery environment
The primary GPT table is corrupt, but the backup appears OK, so that will be used.

答案1

如果您使用逻辑卷作为虚拟机的后备存储,则 LV 将“直接”用作 VM 的磁盘 -ext4您创建的文件系统已被 Windows 安装覆盖,因此您无法再挂载它,因为ext4您的/dev/mapper/volgroup0-lv_disk0LV 现在包含一个带有 Windows 分区的分区表。

如果您想从 Windows VM 访问数据,您可以使用libguestfs

要修复您的启动问题,请/dev/mapper/volgroup0-lv_disk0从您的中删除该条目fstab

相关内容