User Tools

Site Tools


doc:appunti:hardware:raspberrypi_nas_smart_hard_disk

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:appunti:hardware:raspberrypi_nas_smart_hard_disk [2021/03/11 09:44] – [smartctl] niccolodoc:appunti:hardware:raspberrypi_nas_smart_hard_disk [2022/01/07 14:04] (current) – [Letting the hard drive to remain in standby mode] niccolo
Line 1: Line 1:
 ====== Raspberry Pi NAS: Hard disk management ====== ====== Raspberry Pi NAS: Hard disk management ======
 +
 +This page is about configuring the **hard disk power management** on a Raspberry Pi, to be used as NAS and mediacenter. The hard disk is connected via a **[[raspberrypi_nas_x835_sata_board|SupTronics X835 shield]]**. See the main index at **[[raspberrypi_nas]]**.
  
 There are two tools to manage SATA disks in GNU/Linux. **smartctl** is designed to interact with the **[[wp>S.M.A.R.T.]]** capabilities of a disk. **hdparm** is a command line interface to the Linux kernel SATA subsystem, including Advanced Power Management. There are two tools to manage SATA disks in GNU/Linux. **smartctl** is designed to interact with the **[[wp>S.M.A.R.T.]]** capabilities of a disk. **hdparm** is a command line interface to the Linux kernel SATA subsystem, including Advanced Power Management.
Line 18: Line 20:
 # Disable DEVICESCAN, which does not work in our environment. # Disable DEVICESCAN, which does not work in our environment.
 #DEVICESCAN -d removable -n standby -m root -M exec /usr/share/smartmontools/smartd-runner #DEVICESCAN -d removable -n standby -m root -M exec /usr/share/smartmontools/smartd-runner
- 
-# Send an email test to <root@localhost> on daemon start. 
-/dev/sda -d sat -m root@localhost -M test 
  
 # Use the suggedested subset of checks, instead of the '-a'. # Use the suggedested subset of checks, instead of the '-a'.
 +# NOTICE: We are running smartd with option --interval=3600 instead of the
 +# 1800 default, i.e. device polling occurs every 1 our instead of 30 minutes.
 +# The number of skipped checks (option -n) must be multipled by that value
 +# to obtain the maximum time that checks will be skipped:
 +# 336 * 3600 seconds = 14 days.
 /dev/sda -d sat \ /dev/sda -d sat \
     -H \                # Check the health with the SMART RETURN STATUS command     -H \                # Check the health with the SMART RETURN STATUS command
Line 95: Line 99:
 </code> </code>
  
-Regardless of the APM level, we can set the hard disk **Standby timer** (spindown) after 30 minutes of inactivity. See **man hdparm** for explanation of the number following the **%%-S%%** option (it seems that there is not way to know the timeout once you have set it):+Regardless of the APM level, we can set the hard disk **Standby timer** (spindown) after 30 minutes of inactivity. See **man hdparm** for explanation of the number following the **%%-S%%** option (the granularity of the timer up to 20 minutes is 5 seconds, above that threshold it is 30 minutes). It seems that there is not way to know the timeout once you have set it.
  
 <code> <code>
Line 115: Line 119:
 # It is advisable to disable write cache in this case. # It is advisable to disable write cache in this case.
 # See man hdparm(8), -S and -W options. # See man hdparm(8), -S and -W options.
 +# The granularity of the spindown_time up to 20 minutes is 5
 +# seconds, above that threshold it is 30 minutes.
 /dev/sda { /dev/sda {
         write_cache = off         write_cache = off
Line 154: Line 160:
  
   * **updatedb** - Execute by the **/etc/cron.daily/mlocate** cronjob, will update the database of files stored on hard disk. Add the directory to be skipped into **/etc/updatedb.conf**.   * **updatedb** - Execute by the **/etc/cron.daily/mlocate** cronjob, will update the database of files stored on hard disk. Add the directory to be skipped into **/etc/updatedb.conf**.
-  * **smartctl** - Reading SMART attributes (e.g. disk temperature, errors log) awake the disk. Hou may have periodic checks executed by **snmpd**, etc.+  * **smartctl** - Reading SMART attributes (e.g. disk temperature, errors log) awake the disk. You may have periodic checks executed by **snmpd**, etc.
  
 ===== Web References ===== ===== Web References =====
  
   * **[[https://www.thomas-krenn.com/en/wiki/SMART_tests_with_smartctl|SMART tests with smartctl]]**   * **[[https://www.thomas-krenn.com/en/wiki/SMART_tests_with_smartctl|SMART tests with smartctl]]**
 +  * **[[https://serverfault.com/questions/275364/get-drive-power-state-without-waking-it-up/|Get drive power state without waking it up]]** 
 +  * **[[https://unix.stackexchange.com/questions/366438/hard-disk-not-going-to-standby-automatically|Hard disk not going to standby automatically]]** 
 +  * **[[https://serverfault.com/questions/305847/how-to-determine-disc-spindown-time|How to determine disc spindown time]]**
  
doc/appunti/hardware/raspberrypi_nas_smart_hard_disk.1615455858.txt.gz · Last modified: 2021/03/11 09:44 by niccolo