Installing Void Linux on ZFS with Hibernation Support
17 points by draga79
17 points by draga79
So if I understand it correctly, zfs with a separate swap partition is possible, however only if you make sure that your hibernation startup initramfs will not try to mount your zpool, otherwise you'll run into corruption issues. This remains unchanged unfortunately
ZFSBootMenu should import the pool as read-only - so it should be safe enough.
So it would mount rootfs / (etc) first read-only and then keep the rw mount from before hibernating? Shouldn't it then also take care to umount the read-only one? Also afaik whilst ext4 support multiple mounts of one block device, zfs will show an error message.
I'm trying to find a reference for the read-only part, on checking "resume", "hibernate", "read-only" in both the docs, source, issues/PRs, commits, I couldn't find something implementing that part / or at least I don't understand how these things play together.
All I could find:
neither seem to be fully taking care of safety to booting up after hibernation.
Good to hear it's working with ZFSBootMenu, I'd just like to replicate it in my NixOS setup.
Shouldn't it then also take care to umount the read-only one?
After resuming from hibernation, the notion of "the old one" stops making sense — the ≈entire contents of RAM, including the kernel, are replaced with what's in the hibernation image.
Making a temporary R/O mount (or, in case of ZFS, rather a temporary import) of the rootfs in this situation is fine if and only if the filesystem driver makes a conscious effort to never write to disk anything at all: crash recovery¹, journal replay, updating the superblock "last mounted" flag, etc — all of this has to happen strictly in memory. Not all filesystems support this kind of "super readonly" mode. I'm not sure whether ZFS' readonly pool property qualifies.
¹: a filesystem mounted in such a scenario will appear as if after a crash, so "crash recovery" will be required.
Very nice! I've got a setup like this for my laptop. My swap isn't encrypted so I just have:
root/void/root
org.zfsbootmenu:commandline
resume=UUID=e2634dbb-ebbc-4321-8170-c592650df844 loglevel=4
as my properties. I use ZZZ to hibernate:
$ xlocate bin/ZZZ
runit-void-20250212_2 /usr/bin/ZZZ -> /usr/bin/zzz
I prefer your encryption approach.