Skip to content

RFE/RFC: hd-idle extensibility: add option for a state file #116

@rct

Description

@rct

[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:

date: 2024-07-16, time: 00:13:02, disk: sda, running: 900, stopped: 43144
date: 2024-07-16, time: 01:06:05, disk: sda, running: 1080, stopped: 2102
date: 2024-07-16, time: 02:31:09, disk: sda, running: 960, stopped: 4143

However, hd-idle provides the state information when in debug mode:

disk=sda command=ata spunDown=true reads=1241608102 writes=645717976 idleTime=900 idleDuration=32466 spindown=2024-07-16T03:25:09 spinup=2024-07-16T02:31:09 lastIO=2024-07-16T03:10:09
disk=sdb command=ata spunDown=true reads=26937452 writes=607443752 idleTime=900 idleDuration=194140 spindown=2024-07-14T06:31:35 spinup=2024-07-14T06:05:34 lastIO=2024-07-14T06:16:35

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions