Setting up impermanence on bcachefs subvolumes

Has anyone been able to set up impermanence on a system that uses bcachefs subvolumes?

I know there’s an example showing how to set up impermanence on a system using BTRFS and another for a system using ZFS, but I’m not sure how to translate these to a similar setup for bcachefs.

I’ve tried setting up a minimal configuration, which can be installed with this script. For boot.initrd.postResumeCommands, I tried to translate the example script for BTRFS from the impermanence GitHub repo into a similar one for bcachefs. The installation does finish, albeit with some “A file already exists at /etc/machine-id!” and “Activation script snippet ‘persist-files’ failed (1)” errors.

Booting into the installed system, dmesg also shows the same errors and likewise when trying to run sudo nixos-rebuild switch, which fails.

Impermanence itself doesn’t seem to be working properly, as when I write a file that shouldn’t be persisted (e.g., with echo foobar > ~/foobar), that file is still present upon rebooting.

2 Likes

Although it doesn’t directly address my question, someone on Matrix kindly shared how they set up preservation (a module similar to impermanence) with bcachefs subvolumes on their system.