storaged-project / udisks

The UDisks project provides a daemon, tools and libraries to access and manipulate disks, storage devices and technologies.
https://storaged.org/doc/udisks2-api/latest/
Other
347 stars 142 forks source link

Provide a way to set default SMART options for all drives #668

Open dark-penguin opened 5 years ago

dark-penguin commented 5 years ago

It would be very convenient if we could have a way to set "default" options for all drives. The most obvious way would be allowing an [ATA] section in udisks.conf .

I wouldn't mind setting those options via udisks2 instead of hdparm or smartd, if that is necessary to stop udisks2 from breaking smartd/hdparm functionality (#407), even though this would make configuring servers and desktops differently. At least it would be easier than the only workaround we have now.

I would assume most people want the same standby timeout for all their drives, and the same goes for at least some other options, too. Finding out the correct device:tag for each device is not easy, especially for a "normal desktop user", and especially "in a highly dynamic system" which is the actual target case for udisks (i.e. swapping hard drives often without having to remember to manually report it to udisks).

tbzatek commented 5 years ago

FWIW, I suppose you're talking both about the ATA Power Management (PM) features and SMART monitoring interval.

I agree that both should be configurable to some degree, both as defaults for all drives and for each one individually.

In current Linux world there's no way to tell who is breaking whose settings and whose settings should be primarily respected. Mutual awareness would be great to have, though I can't imagine how to solve this in an elegant way without heavy config files parsing (nearly impossible given how distributions vary with hdparm config files location, syntax and initscripts).

There's a long-term plan to transition from unmaintained libatasmart to smartmontools that would help to solve some of the issues (and related issues in #407).

dark-penguin commented 5 years ago

I'm not sure exactly how many other functions are there to configure, but since all those things were usually governed by smartd, I just called them "SMART options". :) Among those, I'm mostly concerned about the standby timeout, but the more general problem I noticed is "wow, seriously? It's not possible to configure them for all drives without making a specific config for each drive?". So this is not about mutual awareness, which is indeed a discussion for that other issue - it's just about missing default config functionality, which would make many things easier, including a workaround for that issue.

JohannesNeu commented 4 years ago

I am having the same issue as dark-penguin and I think this request is very reasonable. I am just done setting up 18 different conf files for the HDDs in my server to find out that they dont seem to work, because hdparm -B still show the default values for my drives.

JohannesNeu commented 4 years ago

@dark-penguin , @tbzatek , you have been on this issue for quite some time what do you think about this solution: Lets keep the standard polling interval for all devices that are not specifically configured via udisks2. For each device that has its own .conf file use the "StandbyTimeout" value in [ATA] and add an offset of X (maybe 10 minutes?) or multiply this value with 1.2. This would make sure that the polling only happens after the devices are already in standby which makes udisks2 skip them (at least in my tests) or read the values if the disks are in use which should be sufficiently often to keep track of their status?

dark-penguin commented 4 years ago

I don't do separate .conf files for the drives - I just add one default timeout for all drives in smartd.conf .

Also, udisks2 does "other things" during polling besides SMART health status. It would be good to have a list of what exactly does it do, so that you can make an informed decision about your polling interval, rather than "Those other things are probably nothing important, I hope this won't break anything".

EDIT: What I mean is, we need a very simple thing - an "off" switch. In a very obvious place (/etc/default/udisks2 , for example), if it's not the default. I would suggest that it should be "on" by default, however, if smartd is present in the system, then it should be "off" unless forced in /etc/default/udisks2 . Something like this:

# Enable periodical drive polling for SMART information
# (including drive temperature), ... , ... and ...
POLLING="true"

# By default, polling is inhibited if smartd is present in the system.
# Enable this to force allow polling even with smartd present
#FORCE_POLLING="true"
tbzatek commented 1 month ago

FYI, as one of the now available workarounds is to set udev property ID_ATA_SMART_ACCESS=none to avoid retrieving ATA SMART data from the device.

See https://github.com/storaged-project/udisks/pull/1316, https://github.com/storaged-project/libblockdev/pull/1064 and also https://github.com/storaged-project/udisks/releases/tag/udisks-2.10.90