gemini: Add hdparm setting
authorLinus Walleij <linus.walleij@linaro.org>
Fri, 23 Jul 2021 10:29:27 +0000 (12:29 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 8 Aug 2021 17:50:45 +0000 (19:50 +0200)
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>
target/linux/gemini/base-files/etc/board.d/03_hdparm [new file with mode: 0644]

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 (file)
index 0000000..27f2b76
--- /dev/null
@@ -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