don't wake up disks

This commit is contained in:
Daniel Langbein 2023-10-09 14:00:40 +02:00
parent 8a7729f9c7
commit 3c81fc5439
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002

View File

@ -56,6 +56,11 @@
# # -i 120: Spin down after 2 minutes (120 seconds) of inactivity.
# ExecStart = "${pkgs.hd-idle}/bin/hd-idle -a /dev/disk/by-id/XXX-XXX-XXX -i 120";
# Note about the `script` settings below.
# If the disk is spun-down (in standby mode):
# - The standby timeout has been set before already, otherwise it would be spinning.
# - Don't set the standby timeout again, as this will spin up the disk.
{
environment.systemPackages = with pkgs; [
hdparm
@ -63,25 +68,25 @@
systemd.services."hdparm-4tb1" = {
description = "Spin down inactive HDD";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.hdparm}/bin/hdparm -S 24 /dev/disk/by-id/ata-WDC_WD40EFRX-68N32N0_WD-WCC7K0CPF0N1";
};
serviceConfig.Type = "oneshot";
script = ''
${pkgs.hdparm}/bin/hdparm -C /dev/disk/by-id/ata-WDC_WD40EFRX-68N32N0_WD-WCC7K0CPF0N1 | ${pkgs.busybox}/bin/grep 'standby' || ${pkgs.hdparm}/bin/hdparm -S 24 /dev/disk/by-id/ata-WDC_WD40EFRX-68N32N0_WD-WCC7K0CPF0N1
'';
};
systemd.services."hdparm-3tb1" = {
description = "Spin down inactive HDD";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.hdparm}/bin/hdparm -S 24 /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-WCC4N1173157";
};
serviceConfig.Type = "oneshot";
script = ''
${pkgs.hdparm}/bin/hdparm -C /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-WCC4N1173157 | ${pkgs.busybox}/bin/grep 'standby' || ${pkgs.hdparm}/bin/hdparm -S 24 /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-WCC4N1173157
'';
};
systemd.services."hdparm-3tb2" = {
description = "Spin down inactive HDD";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.hdparm}/bin/hdparm -S 24 /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-WMC4N0564095";
};
serviceConfig.Type = "oneshot";
script = ''
${pkgs.hdparm}/bin/hdparm -C /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-WMC4N0564095 | ${pkgs.busybox}/bin/grep 'standby' || ${pkgs.hdparm}/bin/hdparm -S 24 /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-WMC4N0564095
'';
};
}