git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #81610 from Mic92/zfs

nixos/zfs: continue trimming also if one pool fails

commitbbbf224c7d7071985d75c80ce64e29d825dcfe72 authorJörg Thalheim <Mic92@users.noreply.github.com> dateWed 4 Mar 2020, 11:44 (7 years ago) parent7f9131f8f543ed
1 file changed+5−1
nixos/modules/tasks/filesystems/zfs.nix+5−1
nixos/modules/tasks/filesystems/zfs.nix+5−1
@@ -623,7 +623,11 @@ in
623623 after = [ "zfs-import.target" ];
624624 path = [ packages.zfsUser ];
625625 startAt = cfgTrim.interval;
626− serviceConfig.ExecStart = "${pkgs.runtimeShell} -c 'zpool list -H -o name | xargs --no-run-if-empty -n1 zpool trim'";
626+ # By default we ignore errors returned by the trim command, in case:
627+ # - HDDs are mixed with SSDs
628+ # - There is a SSDs in a pool that is currently trimmed.
629+ # - There are only HDDs and we would set the system in a degraded state
630+ serviceConfig.ExecStart = ''${pkgs.runtimeShell} -c 'for pool in $(zpool list -H -o name); do zpool trim $pool; done || true' '';
627631 };
628632 })
629633 ];