Hibernation + zfs root + seperate SWAP safe?

Hi, I have this disk layout:

  • boot&efi (vfat) (systemd-boot)
  • LUKS2+LVM
    • SWAP
    • ZFS (the rest)

I heard that zfs doesn’t support hibernation - and hibernation is therefore disabled in /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/tasks/filesystems/zfs.nix .

Can I safely enable hibernation again - since I have a non-ZFS Swap Partition? Just setting that?

boot.zfs.allowHibernation = true;

Thanks in advance!
Thomas

No. It’s disabled by default for a very good reason. For one thing, NixOS currently imports ZFS pools before resuming, which is an extremely likely way to destroy your pools. We have a PR to fix that part, but it’s had merge conflicts for many months (which would be easy to fix; EDIT: hey look it’s fixed).

I can’t say I’m all that motivated to get it merged myself though, because it still wouldn’t be safe. There are still known issues with using hibernation with ZFS, which may only rarely kill pools, but certainly will kill pools. I strongly recommend against hibernation when ZFS is in use whatsoever.

5 Likes

Thank you very much for your info! I will follow the (now merged) issue and keep hibernation disabled for now. Thank you very much!!

Thomas