Created
March 10, 2025 22:29
-
-
Save AaronBeier/48146eef7b3eb5651b500fcc77ba6bf9 to your computer and use it in GitHub Desktop.
Simple bash script to allow all HDDs to spin down
This file contains hidden or 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
| #!/bin/bash | |
| # See https://wiki.archlinux.org/title/Hdparm#Power_management_configuration | |
| # for -B and -S explanations and values | |
| for disk in /sys/block/sd*; do | |
| disk_name=$(basename "$disk") | |
| rotational=$(cat "/sys/block/$disk_name/queue/rotational") | |
| if [ "$rotational" -eq 0 ]; then | |
| continue | |
| fi | |
| hdparm -B 127 /dev/$disk_name > /dev/null 2>&1 | |
| hdparm -S 120 /dev/$disk_name > /dev/null 2>&1 | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment