Arch-Linux

luks 加密磁碟上基於 KVM 磁碟的 VM

  • July 27, 2021

我有一個執行基於 Windows 10 磁碟的虛擬機的 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:

fstab片段:

# /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

blkid片段:

/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.

如果您使用邏輯卷作為虛擬機的備份儲存,則 LV 將“直接”用作虛擬機的磁碟——ext4您創建的文件系統已被 Windows 安裝覆蓋,因此您無法再掛載它,因為ext4您的/dev/mapper/volgroup0-lv_disk0LV 現在包含一個帶有 Windows 分區的分區表。

如果你想從你的 Windows VM 訪問數據,你可以使用libguestfs

要解決您的啟動問題,請/dev/mapper/volgroup0-lv_disk0從您的fstab.

引用自:https://unix.stackexchange.com/questions/660081