-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 09d0122
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Olav Reinert | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# hd-standby | ||
|
||
A small Linux utility to make it easy to configure a mechanical harddisk to | ||
enter standby mode (where the platters stop spinning) after a certain period of | ||
inactivity. | ||
|
||
The implementation is based on the `hdparm`(8) program to control the disks. | ||
|
||
A systemd service unit can be used to ensure that the configuration is always | ||
applied consistently when the computer boots as well as waking up from a | ||
low-power state. | ||
|
||
## Usage | ||
|
||
The script `hdstandby` applies a timeout value to a disk: | ||
|
||
hdstandby <disk> <timeout> | ||
|
||
The parameters are: | ||
|
||
* `disk`: The name of a disk (see below) to apply the timeout to. | ||
* `timeout`: A timeout value like the one given to `hdparm -S`. | ||
|
||
The script checks that a rotational disk is specified, but other than that | ||
there's no error checking. Even though this permits setting a timeout on types | ||
of block devices that are not plain harddisks (e.g., MD arrays), doing so is | ||
not supported, and the effects of it are undefined. | ||
|
||
## Configuration | ||
|
||
To configure a permanent standby timeout (10 minutes by default) for a disk | ||
(e.g., `/dev/sda`), run: | ||
|
||
systemctl enable --now hd-standby@sda | ||
|
||
Repeat this for every disk in your system you want to apply a standby timeout to. | ||
|
||
## Disk names | ||
|
||
You can use names found in the following directories to specify a disk name: | ||
|
||
* `/dev/` | ||
* `/dev/disk/by-id/` | ||
* `/dev/disk/by-path/` | ||
|
||
For example, if the name `/dev/disk/by-path/pci-0000:00:04.0` refers to a | ||
harddisk on your system, you can enable the standby timer for it with | ||
|
||
systemctl enable --now hd-standby@pci-0000:00:04.0 | ||
|
||
## References | ||
|
||
* [`hdparm`(8)](https://man7.org/linux/man-pages/man8/hdparm.8.html) |