Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions spindown-v25.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TrueNAS v25 spindown patch
# TrueNAS v25 spindown patch
# Adds standby-aware smartctl/hdd temp handling, maintains standby disk state, disables the encrypted-key sync periodic jobs,
# and changes SMART alert checks to 360 minutes. (Always set this value higher than your preferred HDD standby timeout to
# and changes SMART alert checks to 360 minutes. (Always set this value higher than your preferred HDD standby timeout to
# prevent SMART polling from touching the disk before it reaches standby and restarting the standby timer).

# Create an overlay to mount and patch copies of the included system files with spindown-fix.sh
Expand Down Expand Up @@ -54,7 +54,7 @@

def smartctl_test(
self, ttype: typing.Literal["long", "short", "offline", "conveyance"], raise_alert: bool = True
@@ -352,6 +357,14 @@
@@ -352,6 +357,28 @@
path = f"{base}/device/hwmon"

rv = {"temp_c": None, "crit": None}
Expand All @@ -63,7 +63,21 @@
+ with open(f'{MIDDLEWARE_RUN_DIR}/standby_disks', 'r') as file:
+ if self.name in file.read().split(','):
+ return TempEntry(**rv)
+ except:
+ except FileNotFoundError:
+ # The standby_disks state file is written by plugins/disk.py during
+ # disk.power_management. On some releases (observed on 25.10.4 and
+ # 25.10.5) it is absent at runtime, so the guard above never fires
+ # and temp1_input is read on every poll. Each read issues a command
+ # to the disk and restarts its idle timer, so a rotational disk
+ # never reaches standby. Skip temperature reads for rotational
+ # disks in that case; SSD/NVMe temperatures are unaffected.
+ try:
+ with open(f"/sys/block/{self.name}/queue/rotational") as rot:
+ if rot.read().strip() == "1":
+ return TempEntry(**rv)
+ except Exception:
+ pass
+ except Exception:
+ pass
+
try:
Expand Down Expand Up @@ -111,4 +125,4 @@
+ file.write(','.join(disk_list))

return await self.middleware.call('disk.power_management_impl', dev, disk)