8000 smartd hotplug support · Issue #297 · smartmontools/smartmontools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

smartd hotplug support #297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jjakob opened this issue Nov 14, 2024 · 1 comment
Open

smartd hotplug support #297

jjakob opened this issue Nov 14, 2024 · 1 comment

Comments

@jjakob
Copy link
jjakob commented Nov 14, 2024

It would be nice to add hotplug disk detection to smartd. If there are disks defined in smartd.conf that are removable, say in an USB-(S)ATA enclosure, it would be useful to apply any '-e' configuration options when they are plugged in. Also to restart monitoring when plugged even if they weren't present when smartd started (this may already work with '-d removable', not sure - '-e' definitely does not).

Say if I have a line in smartd.conf
/dev/disk/by-id/usb-Example_Disk-0:0 -d removable -e standby,48

I would expect the standby timeout setting to be applied whenever the disk is hotplugged, as the setting is volatile, the disk does not remember it.

As this currently isn't possible, I had to resort to a workaround using a udev rule:
ACTION=="add", SUBSYSTEM=="block", ENV{ID_USB_TYPE}=="disk", ENV{ID_ATA_ROTATION_RATE_RPM}=="?*", ENV{ID_ATA_ROTATION_RATE_RPM}!="0", RUN+="/usr/bin/hdparm -S 48 $devnode"
This will apply the standby timeout setting to all USB disks with a non-zero rotation rate, hopefully this will exclude any flash and SSD drives.

@chrfranke
Copy link

This is a really long standing request, see ticket 60.

The following enhancement may work:

  • Add a -d replaceable or -d hotplug directive for smartd.conf.
  • If specified and the device is missing, behave like existing -d removable.
  • If specified and the device is present, re-check the device identity after each device open(). This needs to be implemented separately for ATA, SCSI and NVMe.
  • If device identity has changed, ignore the device during this check cycle and trigger a smartd reload before next check cycle.

Pros:

  • It does not require platform specific code.

Cons:

  • It may not be safe to use if the device type could change (e.g. SATA<=>SAS behind SAS controller, SATA<=>NVMe behind USB bridge).
  • It does not detect newly added devices if DEVICESCAN is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
0