nixos/btrfs: make autoScrub not prevent shutdown or suspend
Fixes: #79086 #79017
This commit is contained in:
parent
8130f3c1c2
commit
5359d90b15
|
@ -118,12 +118,17 @@ in
|
||||||
fs' = utils.escapeSystemdPath fs;
|
fs' = utils.escapeSystemdPath fs;
|
||||||
in nameValuePair "btrfs-scrub-${fs'}" {
|
in nameValuePair "btrfs-scrub-${fs'}" {
|
||||||
description = "btrfs scrub on ${fs}";
|
description = "btrfs scrub on ${fs}";
|
||||||
|
# scrub prevents suspend2ram or proper shutdown
|
||||||
|
conflicts = [ "shutdown.target" "sleep.target" ];
|
||||||
|
before = [ "shutdown.target" "sleep.target" ];
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
# simple and not oneshot, otherwise ExecStop is not used
|
||||||
|
Type = "simple";
|
||||||
Nice = 19;
|
Nice = 19;
|
||||||
IOSchedulingClass = "idle";
|
IOSchedulingClass = "idle";
|
||||||
ExecStart = "${pkgs.btrfs-progs}/bin/btrfs scrub start -B ${fs}";
|
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);
|
in listToAttrs (map scrubService cfgScrub.fileSystems);
|
||||||
|
|
Loading…
Reference in New Issue