mr.*_*eer 6 suspend hibernate swap luks 21.10
我想在 LUKS 加密文件系统上拥有 32GB 的 SWAP 并启用休眠功能。我的基本交换分区是 1GB,我已将 \xc2\xb4/swapfile\' 设为 31GB。我首先尝试使用此处fallocate解释的命令。我将我的和编辑为:/etc/initramfs-tools/conf.d/resume/etc/default/grub
> cat /etc/initramfs-tools/conf.d/resume \nRESUME=UUID=<uuid> resume_offset=<offset>\nRun Code Online (Sandbox Code Playgroud)\n其中 和 是命令的结果:
\n> sudo findmnt -no UUID -T /swapfile\n> sudo filefrag -v /swapfile | awk \'{ if($1=="0:"){print substr($4, 1, length($4)-2)} }\'\nRun Code Online (Sandbox Code Playgroud)\n我打电话sudo update-grub并sudo update-initramfs -u。它不起作用。
比我尝试使用命令删除旧的/swapfile并创建新的。dd
> sudo dd if=/dev/zero of=/swapfile bs=1024 count=32768k\n33554432+0 records in\n33554432+0 records out\n34359738368 bytes (34 GB, 32 GiB) copied, 69,0213 s, 498 MB/s\n> sudo mkswap /swapfile \nmkswap: /swapfile: insecure permissions 0644, 0600 suggested.\nSetting up swapspace version 1, size = 32 GiB (34359734272 bytes)\nno label, UUID=b86d678c-9717-44a0-876d-6ee9e26f3685\n> sudo chmod 0600 /swapfile \n> sudo swapon -a\nRun Code Online (Sandbox Code Playgroud)\n比我使用上面的 UUID 并再次编辑/etc/initramfs-tools/conf.d/resume,/etc/default/grub然后调用\nsudo update-grub和sudo update-initramfs -u。以下是一些输出:
> cat /etc/initramfs-tools/conf.d/resume \nRESUME=UUID=b86d678c-9717-44a0-876d-6ee9e26f3685\n> sudo update-initramfs -u\nupdate-initramfs: Generating /boot/initrd.img-5.13.0-22-generic\ncryptsetup: ERROR: Couldn\'t resolve device \n UUID=b86d678c-9717-44a0-876d-6ee9e26f3685\nW: initramfs-tools configuration sets RESUME=UUID=ea58698b-f7ec-425a-950f-f5e5bae157ce\nW: but no matching swap device is available.\nI: The initramfs will attempt to resume from /dev/dm-2\nI: (/dev/mapper/vgubuntu-swap_1)\nI: Set the RESUME variable to override this.\nRun Code Online (Sandbox Code Playgroud)\n我也尝试/etc/fstab过从/swapfileto更改条目UUID,但没有成功
更多系统信息:
\n> blkid\n/dev/mapper/nvme0n1p3_crypt: UUID="5XbV4n-kt79-RvIe-xKsA-ZfX3-fqLJ-8FW9Zt" TYPE="LVM2_member"\n/dev/mapper/vgubuntu-root: UUID="ea58698b-f7ec-425a-950f-f5e5bae157ce" BLOCK_SIZE="4096" TYPE="ext4"\n/dev/nvme0n1p3: UUID="f7314e8e-de0d-4932-a081-5ebbaec6434b" TYPE="crypto_LUKS" PARTUUID="89c52d41-d933-4ea0-8741-0e52d04f82f7"\n/dev/loop0: TYPE="squashfs"\n/dev/loop1: TYPE="squashfs"\n/dev/loop2: TYPE="squashfs"\n/dev/loop3: TYPE="squashfs"\n/dev/loop4: TYPE="squashfs"\n/dev/loop5: TYPE="squashfs"\n/dev/loop6: TYPE="squashfs"\n/dev/loop7: TYPE="squashfs"\n/dev/nvme1n1p1: UUID="5d52d5c1-aa21-4a99-8faa-7b397017ae5e" TYPE="crypto_LUKS" PARTUUID="6cc4e2cc-c761-47f4-9a17-522bfcb5db9e"\n/dev/nvme0n1p1: UUID="E470-EC97" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="8852d515-0378-4677-ac67-544c672c1e2c"\n/dev/nvme0n1p2: UUID="cf67ab1d-e312-40d5-85f2-5f8fd33e3aab" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="7f2c243e-c977-44ae-84b8-783994279798"\n/dev/mapper/vgubuntu-swap_1: UUID="da63ab4f-fdeb-4f50-832c-85d31e9fe479" TYPE="swap"\n/dev/loop8: TYPE="squashfs"\n/dev/loop9: TYPE="squashfs"\n/dev/loop10: TYPE="squashfs"\n/dev/loop11: TYPE="squashfs"\n/dev/loop12: TYPE="squashfs"\n/dev/loop13: TYPE="squashfs"\n/dev/loop14: TYPE="squashfs"\n/dev/mapper/luks-5d52d5c1-aa21-4a99-8faa-7b397017ae5e: LABEL="/home" UUID="af98cf42-73d6-450a-a2fb-b6cd3a16a04b" BLOCK_SIZE="4096" TYPE="ext4"\n\n\n> cat /etc/fstab\n# /etc/fstab: static file system information.\n#\n# Use \'blkid\' to print the universally unique identifier for a\n# device; this may be used with UUID= as a more robust way to name devices\n# that works even if disks are added and removed. See fstab(5).\n#\n# <file system> <mount point> <type> <options> <dump> <pass>\n/dev/mapper/vgubuntu-root / ext4 errors=remount-ro 0 1\n# /boot was on /dev/nvme0n1p2 during installation\nUUID=cf67ab1d-e312-40d5-85f2-5f8fd33e3aab /boot ext4 defaults 0 2\n# /boot/efi was on /dev/nvme0n1p1 during installation\nUUID=E470-EC97 /boot/efi vfat umask=0077 0 1\n/dev/mapper/vgubuntu-swap_1 none swap sw 0 0\n/swapfile none swap sw 0 0\nUUID=af98cf42-73d6-450a-a2fb-b6cd3a16a04b /home ext4 defaults 0 2\n\n> ls /dev/mapper\ncontrol nvme0n1p3_crypt vgubuntu-swap_1\nluks-5d52d5c1-aa21-4a99-8faa-7b397017ae5e vgubuntu-root\n\n> /etc/crypttab\nnvme0n1p3_crypt UUID=f7314e8e-de0d-4932-a081-5ebbaec6434b none luks,discard\nluks-5d52d5c1-aa21-4a99-8faa-7b397017ae5e UUID=5d52d5c1-aa21-4a99-8faa-7b397017ae5e none nofail\n\nRun Code Online (Sandbox Code Playgroud)\n我在 grub 和 initramfs-tools 中尝试了文件偏移量和驱动器 UUID 的各种组合。我什至尝试简单地重新启动并希望它能起作用。我不知道下一步该做什么。有人有解决方案吗?
\n