-
Notifications
You must be signed in to change notification settings - Fork 32
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
RFE/RFC: hd-idle extensibility: add option for a state file #116
Comments
I was in need of something exactly like this, and found this issue. Is there any plan of adding something like this @adelolmo ? It would probably be even better to add it to the executable itself, |
To be honest, I've been very reluctant to add any functionality that deviates from the original intention: put disks on standby. |
@rct Out of curiosity, what would be your usecase? I'm trying to understand how this change would be used. |
@adelolmo That makes perfect sense, it's a simple utility, but I believe this change remains true to the core purpose of the software. I primarily envision this being used for machine parsing, so any predefined parseable format is fine, for example JSON. How it should work would depend on how expensive this operation is. If it's a cheap operation, then it would probably make sense to have the executable simply dump the data to stdout, and then the user can do what they want with it (write to disk, read as is, etc). If it's expensive, then having it write periodically to disk would probably be a better idea, and then consumers can read that file as they see fit. Obviously this assumes the user has not configured the state file to be written to a disk hd-idle is supposed to put to standby. For me, I want to continuously query the SMART data of my drives, without disturbing standby or deep EPC states. This utility already knows when drives are idle, and I can use that "for free". |
I took the liberty of simply adding a statefile, using the debug output format, see fork: master...firasdib:hd-idle:master No clue if this is the best way to do it, but I'm not a wiz with Go, but I gave it a shot. |
That's correct that the logfile is more statistics because printed after a full cycle of running-stopped-wakeup. However, could not you use stdout logs:
Probably, the option |
Sorry I missed the activity on this until now (got lost in too many GitHub notification emails) @adelolmo asked:
It is related to #113 (comment) and #70 where hd-idle thinks the disk is spun down because no I/O is occurring but something (smartctl?) has caused the disk to spin back up. Regarding the desire to keep hd-idle clear and single purpose (tracking state via /proc/diskstats, I was thinking along the same lines as @firasdib:
So add a co-utility that uses SMART status when hd-idle believes the drive is idle to ensure that it is in fact spun down. Additionally there are other maintenance type jobs where it would be useful to check whether the disk is idle. |
[This is really meant to be a discussion but that's not enabled on this repo.]
In thinking about what hd-idle currently does by processing
/proc/diskstats
and the limitation that it might not be able to detect disks that get spun up but don't actually do any reads or writes, I'm wondering about the possibilities of extending hd-idle:A separate script could periodically check the state of a drive
smarctl -n standby
or other appropriate command, but it would need to know if a drive is supposed to be idle.Instead of re-implementing the logic of hd-idle, it would be useful if it could get that state from hd-idle. The current logfile doesn't have enough info to be useful in this regard:
However, hd-idle provides the state information when in debug mode:
So my current thought is adding a state file option to hd-idle, where the above data could be periodically written for use by other scripts and utilities. Just like logging, the user would have to take care not to spin up a disk every time the state file gets written.
I think this might be more general then other options like adding additional timers/command options to hd-idle to run a script to verify if drives are spun down
The text was updated successfully, but these errors were encountered: