New ZFS installation script

Hi everyone,

Based on the OpenZFS Root on ZFS page, I wrote a zfs deployment (or rather, a “deploy NixOS on ZFS”) script. I tested it with qemu (/dev/vda) and vmware (/dev/sda) so far, and it works pretty well on there.

I specified the differences and other notes in the README.md. It’s still kind of a work in progress, but I hope this is a welcome addition to the tools people can use for NixOS.

Here it is: nixos-zfs-setup.

Enjoy and looking forward to feedback and so on.
Mark

6 Likes

Thank you for making this!

Have you considered setting -O atime=off ?

Well, not really, I set relatime. Is there that much difference?

I’ve been using GitHub - kirillrdy/nixos-installer on all of my machines

Its not finished either but usable enough for me

1 Like

I set relatime . Is there that much difference?

Good question, but I don’t know!

relatime is “fine” for “most” general-purpose data (that isn’t a mail spool or some kinds of cache dir).

atime=off is a stronger condition, and I wouldn’t recommend in general, but is a good idea for the nix store dataset specifically, because atimes are not used there.

2 Likes

I have also used the OpenZFS guide to install NixOS on a ZFS root. One issue I ran into was that the guide assumes modifying hardware-configuration.nix, which is suboptimal as the file will be overwritten by nixos-generate-config. And without options = [ "zfsutil" "X-mount.mkdir" ] for fileSystem entries ZFS mountpoints conflict with Systemd mounts: they attempt to mount ZFS datasets using mount rather than zfs mount. In the end I opted for using legacy mountpoints for the problematic datasets.

2 Likes

You can do the same changes in any other module file, they will get merged…

3 Likes