While trying to find a unit file for hdparm to replace init.d script, I found the following: http://lists.freedesktop.org/archives/systemd-devel/2012-June/005600.html After reading it, that looks to be pretty reasonable approach as it would also simplify things, making, for example, tweaks to re-run hdparm when resuming from hibernate unneeded and bug 448334 obsolete. This kind of rule could be suggested to people: https://wiki.archlinux.org/index.php/Hdparm#Parking_your_hard_drive Reproducible: Always
udev rules sound reasonable. Anyone tried asking upstream? I'd agree we rather avoid distro-specific inventions if possible.
Agreed; this should not be done at the distro level. I vote for closing this resolved/upstream once a bug is opened there.
But we are already doing the "init.d" way downstream. I don't understand why we need to wait for upstream to have a udev rule while not for adding init.d files to run hdparm at boot time :/ (even looking to have drawbacks compared with udev approach) Anyway, I am not sure if we (or upstream) could provide some generic rule, as we would need a rule inheriting hdparm arguments from some config file and the device to be run on.
I'm not even sure if there can be any kind of 'generic' script with 'generic' config file. The point is that the udev rule itself needs to be matched to the proper device, and then adding proper options is not a problem. We may actually work on making that simpler/more practical. Either providing information, examples, tools to generate udev rules...
@mgorny: True, and if we wrote a tool to generate udev rules, since these rules would be system specific, I would vote to put them in /etc/udev/rules.d. Also, this tool could be included upstream.
(In reply to Michał Górny from comment #1) > udev rules sound reasonable. Anyone tried asking upstream? I'd agree we > rather avoid distro-specific inventions if possible. How about sharing with Debian like we do for multiple other base-system@ pkgs as is. http://packages.debian.org/sid/hdparm They install a static one-liner like this: $ cat /lib/udev/rules.d/85-hdparm.rules: ACTION=="add", SUBSYSTEM=="block", KERNEL=="[sh]d[a-z]*", RUN+="/etc/init.d/hdparm hotplug" (CAUTION! Look out for out-of-date udev generators in the hdparm patchset from Debian.) Debian changelog says: * Allow udev rule to process large numbers of devices (closes: #675624) * Install UDEV rule to /lib/udev/rules.d (closes: #563762, #622568) * Clean up old rules from /etc/udev in postinst (Remember when I said they had a generator, and they ditched it? -ssuominen) * Udev rule can also match for sata devices (closes: #471401)
(In reply to Samuli Suominen from comment #6) > RUN+="/etc/init.d/hdparm hotplug" Looks like I completely failed to cover (explain) the script itself in prev. comment :-(
the init.d file isn't going anywhere (not everyone runs udev) i think we'd have to add a new script for udev & init.d to hit rather than having the udev rule hit the init.d