diff options
author | Kyle Hendricks <kyle-github@mail.hendricks.nu> | 2023-11-22 20:51:11 -0500 |
---|---|---|
committer | Kyle Hendricks <kyle-github@mail.hendricks.nu> | 2023-11-29 20:10:29 -0500 |
commit | 463424129d0c05e5332882613a8363cb3817d0d5 (patch) | |
tree | a75412bfbf7b1f8fa4b99a908e1e6c17aef394a2 /nixos/modules/tasks | |
parent | 59f9784c4291f950edaeb5a7ee9ebc3d86ef431b (diff) | |
download | nixlib-463424129d0c05e5332882613a8363cb3817d0d5.tar nixlib-463424129d0c05e5332882613a8363cb3817d0d5.tar.gz nixlib-463424129d0c05e5332882613a8363cb3817d0d5.tar.bz2 nixlib-463424129d0c05e5332882613a8363cb3817d0d5.tar.lz nixlib-463424129d0c05e5332882613a8363cb3817d0d5.tar.xz nixlib-463424129d0c05e5332882613a8363cb3817d0d5.tar.zst nixlib-463424129d0c05e5332882613a8363cb3817d0d5.zip |
snapraid: fix split parity files
SnapRAID has a feature where you can specify "split" parity files. This is useful when you're using 16tb or bigger ext4-formatted disks for parity. ext4 doesn't support files bigger than 16tb so this "split parity file" can be used to specify two parity files on a single parity disk and SnapRAID will automatically use the subsequent file when the current cannot grow anymore (hits 16TB). You specify these split parity files by separating them with commas in the "parity" config option. This mostly already works except when it comes to the scheduled systemd sync job where it specifies ReadWritePaths. If you specify a parity with multiple files you'll get an error when the systemd job runs: Failed to set up mount namespacing: /run/systemd/unit-root/mnt/parity1/snapraid1.parity,/mnt/parity1/snapraid2.parity: No such file or directory Essentially, when the parity file paths are passed into ReadWritePaths, they're always treated as a single path. This change makes sure to split the paths if they contain a comma. The big concern for this change is if it would break users who have commas in their actual parity file paths. This won't be an issue because SnapRAID itself blindly splits on commas for parity files, so legitimate commas in a parity file path wouldn't work in SnapRAID anyway. See here: https://github.com/amadvance/snapraid/blob/978d812153736c06763192f0f1d4b34e54ad633f/cmdline/state.c#L692 SnapRAID doc for split parity files: https://www.snapraid.it/manual#7.1
Diffstat (limited to 'nixos/modules/tasks')
-rw-r--r-- | nixos/modules/tasks/snapraid.nix | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/nixos/modules/tasks/snapraid.nix b/nixos/modules/tasks/snapraid.nix index 243d25f88423..9570c6b76123 100644 --- a/nixos/modules/tasks/snapraid.nix +++ b/nixos/modules/tasks/snapraid.nix @@ -217,9 +217,13 @@ in # to remove them if they are stale let contentDirs = map dirOf contentFiles; + # Multiple "split" parity files can be specified in a single + # "parityFile", separated by a comma. + # https://www.snapraid.it/manual#7.1 + splitParityFiles = map (s: splitString "," s) parityFiles; in unique ( - attrValues dataDisks ++ parityFiles ++ contentDirs + attrValues dataDisks ++ splitParityFiles ++ contentDirs ); } // optionalAttrs touchBeforeSync { ExecStartPre = "${pkgs.snapraid}/bin/snapraid touch"; |