Skip to content

Fix issues with SMART monitoring script - #2837

Open
pq2 wants to merge 2 commits into
nextcloud:mainfrom
pq2:patch-6
Open

Fix issues with SMART monitoring script#2837
pq2 wants to merge 2 commits into
nextcloud:mainfrom
pq2:patch-6

Conversation

@pq2

@pq2 pq2 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

See commit messages

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

pq2 added 2 commits August 10, 2026 13:21
Add automatic -d device type detection for smartctl

Some drives (especially USB enclosures) require an explicit -d option
(e.g. sat, usbjmicron) for smartctl to communicate with them, since the
USB bridge is not always recognized automatically.

- Add get_smart_device_option() to probe common -d types (sat, sat,12,
  sat,16, usbjmicron, usbsunplus, usbcypress) and detect the correct
  one per drive during setup
- Run `update-smart-drivedb` before detection to increase the chance
  smartctl recognizes the bridge without needing a manual -d option
- Store detected options per drive in DRIVE_OPTS associative array and
  use them for the health check and manual troubleshooting hints
- Replace the generic DEVICESCAN line in /etc/smartd.conf with explicit
  per-drive lines carrying the correct -d option (Direct mode)
- Embed the detected DRIVE_OPTS directly into the generated weekly
  notification script as a static array, assuming USB enclosures don't
  change between runs (no runtime re-detection, no external file)

Signed-off-by: pq2 <github@nhelmschmidt.de>
NVMe drives can have many harmless "Invalid Field in Command" entries
in their Error Information Log without any real issue, so the existing
check for "No Errors Logged" incorrectly flagged healthy NVMe drives
(e.g. Samsung 970 EVO) as unhealthy.

- Detect NVMe drives by device name (nvme*) and only check the overall
  "PASSED" health status for them
- Keep the existing combined check (No Errors Logged + PASSED) for
  SATA/ATA drives unchanged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant