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/04/16 17:18] – [hdparm] niccolodoc:appunti:hardware:raspberrypi_nas_smart_hard_disk [2025/12/09 09:37] (current) – [smartctl] 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]]**.+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]]**. The operating system is **RaspiOS** based on **Debian 11 Bullseye**.
  
 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 26: Line 26:
 # The number of skipped checks (option -n) must be multipled by that value # The number of skipped checks (option -n) must be multipled by that value
 # to obtain the maximum time that checks will be skipped: # to obtain the maximum time that checks will be skipped:
-336 3600 seconds 14 days.+1 hour interval 168 times 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 32: Line 32:
     -l error \          # Report increasing errors number in the Summary SMART error log     -l error \          # Report increasing errors number in the Summary SMART error log
     -f \                # Check for 'failure' of any Usage Attributes     -f \                # Check for 'failure' of any Usage Attributes
-    -n standby,336 \    # Skip smartd checks during standby (max 336 times, add ',q' for quiet)+    -n standby,168 \    # Skip smartd checks during standby (max 168 times, add ',q' for quiet)
     -W 0,50,60 \        # Temperature (SMART att. 194): WARN=50 (log), CRIT=60 (mail)     -W 0,50,60 \        # Temperature (SMART att. 194): WARN=50 (log), CRIT=60 (mail)
-    -s S/../../1/23   # Schedule a short Self-Test at 23:00 of every monday. +                      # Schedule a short Self-Test at 23:00 of every monday
-    -s O/../.././21 \   # Schedule an Offline Immediate Test every day at 21:00.+                      # Schedule an Offline Immediate Test every day at 21:00
 +    -s (S/../../1/23|O/../.././21\
     -m root@localhost \ # Send a warning email on failures and errors     -m root@localhost \ # Send a warning email on failures and errors
     -M daily \          # Repeat email warnings daily     -M daily \          # Repeat email warnings daily
Line 93: Line 94:
 ===== hdparm ===== ===== hdparm =====
  
-To set the **Advanced Power Management** level use the **%%-B%%** option, the maximum performance level which **permits spin-down** of the drive is 127:+To set the **Advanced Power Management** level use the **%%-B%%** option. A low value means aggressive power managementan high value means better performance. The maximum performance level which **permits spin-down** of the drive is 127:
  
 <code> <code>
Line 113: Line 114:
 </code> </code>
  
-Debian provides the file **/etc/hdparm.conf** which is handled by the **udev** on system start to set the required parameters. You can set something like this:+Debian provides the file **/etc/hdparm.conf** which is handled by the **udev** on **system start** to set the required parameters. You can set something like this:
  
 <file> <file>
Line 160: Line 161:
  
   * **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. 
 + 
 +===== udisks2.service ===== 
 + 
 +It seems that the **udisks2.service** may interfere with the hard disk spin-down feature. The ''man 8 udisks'' refers to setting APT options (//StandbyTimeout//, //APMLevel//, ...) via ATA commands. 
 + 
 +It is likely that the hdparm options set by **udev** on system start are overridden by udisks2. In a [[..:software:kodi_installation_raspios_13|system based on RaspiOS 13 Trixie]] I had to remove the **udisks2** package to allow the hard drive to go into standby mode as epxlained above. 
 + 
 +Some useful udisks2 commands: 
 + 
 +<code> 
 +udisksctl info -b /dev/sda3 
 +</code> 
  
 ===== Web References ===== ===== Web References =====
doc/appunti/hardware/raspberrypi_nas_smart_hard_disk.1618586312.txt.gz · Last modified: by niccolo