下方代码块是 /etc/fstab内容, nvme01n1p1 挂在 /boot 上,btrfs on luks 挂在 / 上。swapfile 可用。
# /dev/mapper/cryptroot LABEL=Arch
UUID=3ce4ae2e-004d-483c-9303-a0299d637909 / btrfs rw,relatime,compress=lzo,ssd,space_cache,subvolid=256,subvol=/@,subvol=@ 0 0
# /dev/nvme0n1p1 LABEL=SYSTEM
UUID=58A9-5FF0 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 2
# /dev/mapper/cryptroot LABEL=Arch
UUID=3ce4ae2e-004d-483c-9303-a0299d637909 /home btrfs rw,relatime,compress=lzo,ssd,space_cache,subvolid=258,subvol=/@home,subvol=@home 0 0
# /dev/mapper/cryptroot LABEL=Arch
UUID=3ce4ae2e-004d-483c-9303-a0299d637909 /var/log btrfs rw,relatime,compress=lzo,ssd,space_cache,subvolid=259,subvol=/@log,subvol=@log 0 0
# /dev/mapper/cryptroot LABEL=Arch
UUID=3ce4ae2e-004d-483c-9303-a0299d637909 /var/cache/pacman/pkg btrfs rw,relatime,compress=lzo,ssd,space_cache,subvolid=260,subvol=/@pkg,subvol=@pkg 0 0
# /dev/mapper/cryptroot LABEL=Arch
UUID=3ce4ae2e-004d-483c-9303-a0299d637909 /srv btrfs rw,relatime,compress=lzo,ssd,space_cache,subvolid=261,subvol=/@srv,subvol=@srv 0 0
# /dev/mapper/cryptroot LABEL=Arch
UUID=3ce4ae2e-004d-483c-9303-a0299d637909 /var/tmp btrfs rw,relatime,compress=lzo,ssd,space_cache,subvolid=262,subvol=/@tmp,subvol=@tmp 0 0
# swapfile
/swapfile none swap defaults 0 0
free -h
total used free shared buff/cache available
Mem: 15Gi 2.4Gi 9.9Gi 1.0Gi 3.2Gi 11Gi
Swap: 17Gi 0B 17Gi
下方列出 UUID
$ lsblk -o NAME,UUID
NAME UUID
nvme0n1
├─nvme0n1p1 58A9-5FF0
├─nvme0n1p2
├─nvme0n1p3 7bc92342-679b-4ade-991d-bef347b6b367
│ └─cryptroot 3ce4ae2e-004d-483c-9303-a0299d637909
├─nvme0n1p4
└─nvme0n1p5 929EFA9F9EFA7AD
然后是 REFind config 中 arch 启动的 entry(利用 mkinitcpio-tpm2-encrypt 和 luks-tpm2 实现了 tpm2 decrypt luks)
menuentry "Arch Linux" {
icon /EFI/refind/themes/refind-dreary/icons/os_arch.png
loader vmlinuz-linux-surface
initrd initramfs-linux-surface.img
options "tpmkey=/dev/nvme0n1p1:/keyfile:0x81000003 tpmpcr=sha256:0,2,4,7 random.trust_cpu=on root=UUID=3ce4ae2e-004d-483c-9303-a0299d637909 rw rootflags=subvol=@ cryptdevice=UUID=7bc92342-679b-4ade-991d-bef347b6b367:cryptroot loglevel=3 quiet resume=/dev/mapper/cryptroot resume_offset=3455681"
submenuentry "Boot with fallback initramfs" {
initrd initramfs-linux-surface-fallback.img
}
submenuentry "Boot to terminal: {
add_options "systemd.unit-multi-user.target"
}
}
按照 Suspend_and_hibernate#Hibernation_into_swap_file_on_Btrfs 计算了 offset
但休眠时
systemctl status systemd-hibernate
● systemd-hibernate.service - Hibernate
Loaded: loaded (/usr/lib/systemd/system/systemd-hibernate.service; indirect; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2019-10-23 10:46:25 CST; 59s ago
Docs: man:systemd-suspend.service(8)
Process: 1335 ExecStart=/usr/lib/systemd/systemd-sleep hibernate (code=exited, status=1/FAILURE)
Main PID: 1335 (code=exited, status=1/FAILURE)
10月 23 10:46:25 SurfacePro5 systemd[1]: Starting Hibernate...
10月 23 10:46:25 SurfacePro5 systemd-sleep[1335]: Failed to prepare for hibernation: Operation not supported
10月 23 10:46:25 SurfacePro5 systemd[1]: systemd-hibernate.service: Main process exited, code=exited, status=1/FAILURE
10月 23 10:46:25 SurfacePro5 systemd[1]: systemd-hibernate.service: Failed with result 'exit-code'.
10月 23 10:46:25 SurfacePro5 systemd[1]: Failed to start Hibernate.
请问各位大佬,btrfs on LUKS 上的 swapflie 可否用于 hibernation,如果可以,需要修改哪里?
最近编辑记录 specter119 (2019-10-23 12:36:39)
离线
已经解决,智障了,上面的设置都是对的,/etc/mkinitcpio.conf 没写 resume hook
离线
nvme01n1p1会不会有很多空间闲置?
开源/Linux大众化,从驿窗开始~
离线
nvme01n1p1会不会有很多空间闲置?
/boot 大些好啊,我记得官方也建议这么大?省地方不用在 /boot 省。还有 /boot 里放 livcd 的高端玩家呢,那样不得 1G 起?
离线
这个是好玩法啊,只要grub正常工作可以随时启动Live进行救援。。。
反社会,精神极其不稳定,随时可能炸碎身边所有人
离线