Skip to content

Commit

Permalink
nixos/btrfs: make autoScrub not prevent shutdown or suspend
Browse files Browse the repository at this point in the history
Fixes: #79086 #79017
  • Loading branch information
symphorien committed Feb 14, 2020
1 parent 8130f3c commit 5359d90
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion nixos/modules/tasks/filesystems/btrfs.nix
Expand Up @@ -118,12 +118,17 @@ in
fs' = utils.escapeSystemdPath fs;
in nameValuePair "btrfs-scrub-${fs'}" {
description = "btrfs scrub on ${fs}";
# scrub prevents suspend2ram or proper shutdown
conflicts = [ "shutdown.target" "sleep.target" ];
before = [ "shutdown.target" "sleep.target" ];

serviceConfig = {
Type = "oneshot";
# simple and not oneshot, otherwise ExecStop is not used
Type = "simple";
Nice = 19;
IOSchedulingClass = "idle";
ExecStart = "${pkgs.btrfs-progs}/bin/btrfs scrub start -B ${fs}";
ExecStop = "${pkgs.btrfs-progs}/bin/btrfs scrub cancel ${fs}";
};
};
in listToAttrs (map scrubService cfgScrub.fileSystems);
Expand Down

0 comments on commit 5359d90

Please sign in to comment.