I've installed hdparm like this:
sudo apt install hdparm
sudo hdparm -y /dev/sda # Legt HDD sofort schlafen
sudo nano /etc/hdparm.conf
START_HD_IDLE=true
/dev/sda {
spindown_time = 240
}
sudo hdparm -B 127 -S 240 /dev/sda
sudo hdparm -W 0 /dev/sda1
sudo /usr/lib/pm-utils/power.d/95hdparm-apm resume
I still didn't get the spindown. So I've added hd-idle:
sudo apt-get install build-essential fakeroot debhelper -y
cd Downloads/
wget http://sourceforge.net/projects/hd-idle/files/hd-idle-1.05.tgz
tar -xvf hd-idle-1.05.tgz && cd hd-idle
dpkg-buildpackage -rfakeroot
sudo dpkg -i ../hd-idle_*.deb
sudo nano /etc/default/hd-idle
START_HD_IDLE=true
HD_IDLE_OPTS="-i 1200 -l /var/log/hd-idle.log"
sudo systemctl restart hd-idle
Roughly following the guide from - https://www.htpcguides.com/spin-down-and-manage-hard-drive-power-on-raspberry-pi/
Monitoring
I've monitored the spindowns with:
less +F /var/log/hd-idle.log
I still didn't get the spindowns. Looking at the HDD-LED I could see and hear that something accessed the drive and thus keep it spinning. So I've added two monitoring tools.
Inotify
sudo apt-get install inotify-tools
inotifywait -m /mnt/backup/
and Blktrace
sudo apt install blktrace
sudo btrace /dev/sda
Disable Daemons
Btrace showed lines with "... [smartd]", so I disabled it.
sudo systemctl stop smartd
sudo systemctl disable smartd
and "... [pool]", which is part of the udisk2 crypt-mounting stuff.
sudo systemctl stop udisks2
sudo systemctl disable udisks2
After disabling both daemons I got my spindown.