aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2021-07-23 12:29:27 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2021-08-08 19:50:45 +0200
commit83441522a2389fd44630df3368c3eecf3cb2579f (patch)
tree000a45b0e7196328735799674a7a97052c921079
parentd3794768177293f584cc74f90c921276793da1e7 (diff)
downloadupstream-83441522a2389fd44630df3368c3eecf3cb2579f.tar.gz
upstream-83441522a2389fd44630df3368c3eecf3cb2579f.tar.bz2
upstream-83441522a2389fd44630df3368c3eecf3cb2579f.zip
gemini: Add hdparm setting
This uses "hdparm" (if present) to get the harddisk into low power mode on NAS set-ups. Cc: Adrian Schmutzler <mail@adrianschmutzler.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--target/linux/gemini/base-files/etc/board.d/03_hdparm14
1 files changed, 14 insertions, 0 deletions
diff --git a/target/linux/gemini/base-files/etc/board.d/03_hdparm b/target/linux/gemini/base-files/etc/board.d/03_hdparm
new file mode 100644
index 0000000000..27f2b76042
--- /dev/null
+++ b/target/linux/gemini/base-files/etc/board.d/03_hdparm
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0-only
+# Spin down drives after one minute if inactive
+
+if [ ! -n "$(command -v hdparm)" ]; then
+ exit 0
+fi
+
+DISKS=$(find /dev/sd[a-z] 2>/dev/null)
+for DISK in $DISKS
+do
+ if [ -b $DISK ] ; then
+ hdparm -S 12 $DISK > /dev/null
+ fi
+done