Skip to content
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

Configure USB drive to spin down automatically #2

Open
geerlingguy opened this issue Oct 20, 2016 · 3 comments
Open

Configure USB drive to spin down automatically #2

geerlingguy opened this issue Oct 20, 2016 · 3 comments

Comments

@geerlingguy
Copy link
Owner

Mostly for power consumption, but basically—make this a configurable option (e.g. either enable it or disable it via a bool), and also allow configuration of the time before the drive spins down after inactivity.

Some people might use an SSD here, but most people would likely toss an old spinning rust drive at the Pi for backups (since it's expendable... and since the Pi's USB 2.0 bust can't sustain super fast transfer, at least not in the current generation). So it's nice to conserve energy. Just don't use too quick a frequency for the default spindown as frequent toggles can cause the drive to wear faster.

For some references:

@geerlingguy
Copy link
Owner Author

I've added a new geerlingguy.hdparm role on Ansible Galaxy for control over this parameter. I will also need to see about setting it on-the-fly or if I can get hdparm to read from its conf file... also need to verify things are working. Right now it looks like it'll take at least 30 min to an hour to format the 2 TB USB drive. It would take 4-6 hours if I formatted allowing the initialization to happen in the background!

@geerlingguy
Copy link
Owner Author

geerlingguy commented Oct 24, 2016

To set spin-down on the fly:

# Enable power management on USB HDD.
sudo hdparm -B 127 /dev/sda
# Set spindown time to 10 minutes.
sudo hdparm -S120 /dev/sda

You can check the status of the drive using:

sudo hdparm -C /dev/sda

(Outputs something like active/idle or standby if it's spun down).

geerlingguy added a commit that referenced this issue Oct 24, 2016

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@geerlingguy
Copy link
Owner Author

Looks like this works nicely with the following in /etc/hdparm.conf:

/dev/sda {
    spindown_time = 120
}

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

No branches or pull requests

1 participant