Code Monkey home page Code Monkey logo

hdd-spindown.sh's Introduction

hdd-spindown.sh

Automatic Disk Standby using Kernel diskstats and hdparm

Summary

hdd-spindown.sh is a rather simple Bash script that enables automatic disk standby for drives that do not support timeout-based spindown by firmware (e.g. -S parameter for hdparm).

Usage, Requirements

hdd-spindown.sh is best run via systemd, using the service unit provided. In order to enable it, simply issue

$ systemctl enable hdd-spindown.service

and adapt configuration file /etc/hdd-spindown.rc to suit your needs.

Apart from coreutils the following is required:

  • smartctl: for detection of drive status and SMART self-checks
  • hdparm for actually initiating drive standby
  • grep for utility output parsing

The following is optional, depending on the features used:

  • logger if syslog interface enabled
  • ping if host monitoring enabled

Configuration

hdd-spindown.sh uses a simple shell-style configuration file for setting the disks to monitor. An example may look like this:

# configuration file for hdd-spindown.sh

CONF_INT=300

CONF_DEV=( "ata-WDC_WD50EFRX-68MYMN1_WD-WX31DA43KKCY|5400" \
           "ata-WDC_WD50EFRX-68MYMN1_WD-WX81DA4HNEH5|5400" \
           "ata-WDC_WD20EARS-00MVWB0_WD-WCAZA5755786|5400" \
           "ata-WDC_WD20EARS-00MVWB0_WD-WMAZA3570471|5400" )

CONF_INT specifies the monitoring interval in seconds while CONF_DEV features a list of devices to monitor, as well as their timeout value in seconds, separated by the pipe symbol '|'.

Note that devices may be specified using their ID (as shown) or device name (e.g. 'sda'). The interval option may be omitted, which sets the default interval of 5 minutes.

For a complete list of options please see the example hdd-spindown.rc.

State of Development

I have replaced all of my rotating disks with flash based storage. I will happily accept pull requests for improvements or bug fixes, but I will not be able to test anything myself.

License

This software is released under the terms of the MIT License, see file LICENSE.

hdd-spindown.sh's People

Contributors

lynix avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.