我关注了指导前段时间我在加密的 ZFS 文件系统上设置了我的系统 (ubuntu 22.10),一切运行正常。指南的一部分是加密交换分区。
然后,我将主(交换、启动)驱动器升级为更大的驱动器。我使用 clonezilla 克隆了磁盘,这也很好。
重新启动时,出现如下所示的错误:
它指向现已删除的硬盘交换分区。我更新了 crypttab 以指向新硬盘的交换分区。
我该如何消除/解决该错误?
交换的 FSTAB 条目:
/dev/mapper/swap none swap defaults 0 0
crypttab 条目(反映新的 SSD)
swap /dev/disk/by-id/nvme-nvme.c0a9-323235324536393636464333-43543430303050335053534438-00000001-part3 /dev/urandom swap,cipher=aes-xts-plain64,size=256,plain
我尝试运行 ecryptfs-setup-swap,结果如下:
$ sudo ecryptfs-setup-swap
WARNING: [/dev/dm-0] already appears to be encrypted, skipping.
WARNING: There were no usable swap devices to be encrypted. Exiting.
$ sudo cryptsetup status swap
/dev/mapper/swap is active and is in use.
type: PLAIN
cipher: aes-xts-plain64
keysize: 256 bits
key location: dm-crypt
device: /dev/nvme0n1p3
sector size: 512
offset: 0 sectors
size: 8388608 sectors
mode: read/write
按 ID 划分的磁盘
lrwxrwxrwx 1 root root 10 Mar 2 11:42 dm-name-swap -> ../../dm-0
lrwxrwxrwx 1 root root 10 Mar 2 11:42 dm-uuid-CRYPT-PLAIN-swap -> ../../dm-0
lrwxrwxrwx 1 root root 13 Mar 2 11:42 nvme-CT4000P3PSSD8_2240E671E0D3 -> ../../nvme1n1
lrwxrwxrwx 1 root root 15 Mar 2 11:42 nvme-CT4000P3PSSD8_2240E671E0D3-part1 -> ../../nvme1n1p1
lrwxrwxrwx 1 root root 15 Mar 2 11:42 nvme-CT4000P3PSSD8_2240E671E0D3-part9 -> ../../nvme1n1p9
lrwxrwxrwx 1 root root 13 Mar 2 11:42 nvme-CT4000P3PSSD8_2252E6966FC3 -> ../../nvme0n1
lrwxrwxrwx 1 root root 15 Mar 2 11:42 nvme-CT4000P3PSSD8_2252E6966FC3-part1 -> ../../nvme0n1p1
lrwxrwxrwx 1 root root 15 Mar 2 11:42 nvme-CT4000P3PSSD8_2252E6966FC3-part2 -> ../../nvme0n1p2
lrwxrwxrwx 1 root root 15 Mar 2 11:42 nvme-CT4000P3PSSD8_2252E6966FC3-part3 -> ../../nvme0n1p3
lrwxrwxrwx 1 root root 15 Mar 2 11:42 nvme-CT4000P3PSSD8_2252E6966FC3-part4 -> ../../nvme0n1p4
lrwxrwxrwx 1 root root 13 Mar 2 11:42 nvme-nvme.c0a9-323234304536373145304433-43543430303050335053534438-00000001 -> ../../nvme1n1
lrwxrwxrwx 1 root root 15 Mar 2 11:42 nvme-nvme.c0a9-323234304536373145304433-43543430303050335053534438-00000001-part1 -> ../../nvme1n1p1
lrwxrwxrwx 1 root root 15 Mar 2 11:42 nvme-nvme.c0a9-323234304536373145304433-43543430303050335053534438-00000001-part9 -> ../../nvme1n1p9
lrwxrwxrwx 1 root root 13 Mar 2 11:42 nvme-nvme.c0a9-323235324536393636464333-43543430303050335053534438-00000001 -> ../../nvme0n1
lrwxrwxrwx 1 root root 15 Mar 2 11:42 nvme-nvme.c0a9-323235324536393636464333-43543430303050335053534438-00000001-part1 -> ../../nvme0n1p1
lrwxrwxrwx 1 root root 15 Mar 2 11:42 nvme-nvme.c0a9-323235324536393636464333-43543430303050335053534438-00000001-part2 -> ../../nvme0n1p2
lrwxrwxrwx 1 root root 15 Mar 2 11:42 nvme-nvme.c0a9-323235324536393636464333-43543430303050335053534438-00000001-part3 -> ../../nvme0n1p3
lrwxrwxrwx 1 root root 15 Mar 2 11:42 nvme-nvme.c0a9-323235324536393636464333-43543430303050335053534438-00000001-part4 -> ../../nvme0n1p4
磁盘按部分标签
lrwxrwxrwx 1 root root 15 Mar 2 11:42 Boot -> ../../nvme0n1p2
lrwxrwxrwx 1 root root 15 Mar 2 11:42 EFI -> ../../nvme0n1p1
lrwxrwxrwx 1 root root 15 Mar 2 11:42 Pool -> ../../nvme0n1p4
lrwxrwxrwx 1 root root 15 Mar 2 11:42 Swap -> ../../nvme0n1p3
lrwxrwxrwx 1 root root 15 Mar 2 11:42 zfs-1deacc253f223e81 -> ../../nvme1n1p1
输出:$ sudo systemctl --type swap -all
UNIT LOAD ACTIVE SUB DESCRIPTION
dev-disk-by\x2did-dm\x2dname\x2dswap.swap loaded active active /dev/disk/by-id/dm-name-swap
dev-disk-by\x2did-dm\x2duuid\x2dCRYPT\x2dPLAIN\x2dswap.swap loaded active active /dev/disk/by-id/dm-uuid-CRYPT-PLAIN-swap
dev-disk-by\x2dlabel-swap.swap loaded active active /dev/disk/by-label/swap
dev-disk-by\x2duuid-1c32cf08\x2d4817\x2d4be4\x2d8c40\x2deeafe60330c1.swap loaded active active /dev/disk/by-uuid/1c32cf08-4817-4be4-8c40-eeafe60330c1
dev-dm\x2d0.swap loaded active active /dev/dm-0
dev-mapper-swap.swap loaded active active /dev/mapper/swap
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.
6 loaded units listed.
To show all installed unit files use 'systemctl list-unit-files'.
$ sudo systemctl --type swap
UNIT LOAD ACTIVE SUB DESCRIPTION
dev-mapper-swap.swap loaded active active /dev/mapper/swap
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.
1 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
答案1
sudo update-initramfs -u -k all
sudo update-grub
解决了这个问题!谢谢@Raffa