ZFS: Difference between revisions
→Take snapshots automatically: add services.zfs.autoSnapshot |
→Remote unlock: Remove a note to a closed issue, assuming this has been resolved already. |
||
| (4 intermediate revisions by 4 users not shown) | |||
| Line 62: | Line 62: | ||
Disable the mount service with <code>systemd.services.zfs-mount.enable = false;</code> or remove the <code>fileSystems</code> entries in hardware-configuration.nix. Otherwise, use legacy mountpoints (created with e.g. <code>zfs create -o mountpoint=legacy</code>). Mountpoints must be specified with <code>fileSystems."/mount/point" = {};</code> or with <code>nixos-generate-config</code>. | Disable the mount service with <code>systemd.services.zfs-mount.enable = false;</code> or remove the <code>fileSystems</code> entries in hardware-configuration.nix. Otherwise, use legacy mountpoints (created with e.g. <code>zfs create -o mountpoint=legacy</code>). Mountpoints must be specified with <code>fileSystems."/mount/point" = {};</code> or with <code>nixos-generate-config</code>. | ||
==== Nix builds and ZFS properties like normalization or utf8only ==== | |||
These options are often suggested in guides to setting up ZFS. <code>normalization</code> makes filenames compare the same in cases where there exists more than one UTF8 bytestring that represents the same characters. <code>utf8only</code> prevents the creation of files with non-UTF8 filenames, e.g. filenames using a Latin1 character set. These are non-POSIX and will make the tests for certain packages fail, which may interfere with builds. After nix 2.30, builds no longer happen in /tmp by default, instead they happen in <code>/nix/var/nix/builds</code>. On any system where you plan to run nix builds, you should ensure that this filesystem is POSIX-compliant. Either mounting a tmpfs in that directory (if you have lots of RAM + swap) or creating a zfs dataset there which does not have these or other non-POSIX settings like <code>noatime</code>, <code>snapdir=visible</code>, <code>acltype=nfsv4</code>, or <code>caseinsensitivity=insensitive</code>. Many of these cannot be changed after dataset creation so if this is your root filesystem, you will need to restore from a backup in order to recreate them. | |||
== Guides == | == Guides == | ||
| Line 323: | Line 326: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
You can confirm whether any specified configuration/tuning got applied via commands like <code> | You can confirm whether any specified configuration/tuning got applied via commands like <code>zarcsummary</code> and <code>zarcstat -a -s " "</code>. | ||
== Automatic scrubbing == | == Automatic scrubbing == | ||
| Line 336: | Line 339: | ||
=== Unlock encrypted ZFS via SSH on boot === | === Unlock encrypted ZFS via SSH on boot === | ||
{{ | {{merge|Remote_disk_unlocking}}In case you want unlock a machine remotely (after an update), having an ssh service in initrd for the password prompt is handy: | ||
In case you want unlock a machine remotely (after an update), having an ssh service in initrd for the password prompt is handy: | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
| Line 496: | Line 497: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
{ | { | ||
services.zfs.zed | services.zfs.zed = { | ||
enableMail = true; | enableMail = true; | ||
settings = { | settings = { | ||