106 字
1 分钟
Configuring Watchdog and Automatic Hard Drive Sleep on RPi
  • rpi 3b watchdog
  • Automatic sleep for idle hard drives

Please modify the watchdog device based on your CPU model#


hdparm#


Install hdparm (omitted)

Test hdparm

hdparm link

sudo hdparm -y /dev/sda1

If there’s no error, it’s supported

sudo hdparm -I /dev/sda1|grep cache

If you see ”*”, caching is supported

Edit hdparm

sudo nano /etc/hdparm.conf

Add

/dev/sda1 {
write_cache = on
spindown_time = 120
}

If caching isn’t supported, don’t add the write_cache line

The delay below is calculated as: idle sleep time (minutes) * 60 / 5

watchdog#


Install watchdog (omitted)

Load watchdog

sudo modprobe bcm2835_wdt
sudo nano /etc/modules
bcm2835_wdt

Edit the configuration

sudo /etc/watchdog.conf

Modify

max-load-1=24
watchdog-device = /dev/watchdog
watchdog-timeout=20
temperature-sensor = /sys/class/thermal/thermal_zone0/temp
max-temperature = 85000

Start

sudo systemctl enable watchdog.service
sudo chkconfig watchdog on

Bonus: a fork bomb#

:(){ :|: & };:
Configuring Watchdog and Automatic Hard Drive Sleep on RPi
https://tski.uk/blog/en/rpi-watchdog-config/
作者
Tokisaki Galaxy
发布于
2019-11-05
许可协议
CC BY