Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.
HDD Spindown Timer

HDD Spindown Timer 1.3.1

ngandrass

Member
Joined
Jun 26, 2019
Messages
45
I'm trying to use your script which fits my use case perfectly. Sadly, the drives are spinning up from a few seconds to no more than a minute after spinning down.
Hi,

can you please provide a screenshot of the disk configurations that are part of the affected pool? Please make sure that "HDD Standby" is set to "Always On", since it would interfere with the script otherwise. See: https://github.com/ngandrass/freenas-spindown-timer#configure-disk-standby-settings

Where do you have the spindown script placed? If it is located inside the pool it could result in spinning up the associated disks.
Is it furthermore possible that any of your services access the pool (Samba/NFS/Virtual Machines/...)? Or maybe your share is still mounted on some client that periodically performs reads?

I hope we can quickly fix your issue :)
 

blemasle

Junior Member
Joined
Mar 1, 2021
Messages
13
Here you go. That's one of the disk on the pool (there's 6 of them)

1614798962363.png

The -d atacam -n standby you see is a try I made when I saw that reading smart values for one of the pool drive was spinning up the disk again (and that -d might be required to avoid smartcl to spin up the drive to find its kind). But it does not change a thing since it is overriden (I guess) by the smartd.conf.

Code:
/dev/ada1 -a -d removable -n never -W 0,0,0 -m root -M exec /usr/local/libexec/smart_alert.py\
-s S/../../(3)/(03)\
 -d atacam -n standby


For the moment, I run the script directly from the terminal. The script itself is located at /root/scripts/freenas-spindown-timer/spindown_timer.sh.

The system dataset is on the boot pool, and I have no VM running nor shares being accessed. I left no other machine running other than the NAS itself to be sure and the disks were spinning up after a while.

One curious thing I noted is that the drives actually spin up around the 5 minutes most of the time. I set the standby timer in the script to 2 minutes to do some tests, and the drives did come up at regular interval around a multiple of 5 minutes (5, 10, 15 etc). Smart reads occur every 5 minute on my NAS so I bet this is related

Also, If I'm not using the script and use the standard TrueNAS implementation, the drives also spin up around the same time mark. So I guess this is not related to your script, but rather to the -d removable -n never that TrueNAS put in the smartcld.conf that will probably spin up the drive every time a smart read is executed...

One thing to be noted is that my drives are not in the smartcl database, so maybe smartd is doing something that wakes the drives on every read whereas that information would come from the database on a standard drive ?

Code:
=== START OF INFORMATION SECTION ===
Device Model:     TOSHIBA HDWQ140
Serial Number:    80VVK49HFAYG
LU WWN Device Id: 5 000039 a3c602251
Firmware Version: FJ1M
User Capacity:    4,000,787,030,016 bytes [4.00 TB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    7200 rpm
Form Factor:      3.5 inches
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ATA8-ACS (minor revision not indicated)
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Wed Mar  3 20:32:15 2021 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
 

ngandrass

Member
Joined
Jun 26, 2019
Messages
45
Hey,

I'm not really sure what is going on here...

Comparing our disk configurations they only differ in the S.M.A.R.T. Extra Options and the Acoustic Level:
1615110328221.png


How is your S.M.A.R.T. service configured (See: Services -> S.M.A.R.T.)? Here is how it looks in my case:
1615110431831.png

There might be some issue with your check interval... However, this would more likely prevent the drives from spinning down rather then spinning them up again :/

Another thing to look at would be the verbose logs of the spindown script. Can you determine if the spindown script detects I/O before a wakeup occours? Otherwise it must be I/O independent (i.e. related to S.M.A.R.T.).
 

blemasle

Junior Member
Joined
Mar 1, 2021
Messages
13
Hey,

I'm not really sure what is going on here...

Comparing our disk configurations they only differ in the S.M.A.R.T. Extra Options and the Acoustic Level:
View attachment 45707

How is your S.M.A.R.T. service configured (See: Services -> S.M.A.R.T.)? Here is how it looks in my case:
View attachment 45708
There might be some issue with your check interval... However, this would more likely prevent the drives from spinning down rather then spinning them up again :/

Another thing to look at would be the verbose logs of the spindown script. Can you determine if the spindown script detects I/O before a wakeup occours? Otherwise it must be I/O independent (i.e. related to S.M.A.R.T.).
Here you go
1615119560208.png

I tried the same options as you showed here and it didn't change a thing. The spindown scripts does not detect I/O before a wakeup. The wakeups being on the 5 minutes marks, I'm pretty sure the issue lies within S.M.A.R.T. readings (see below).

The S.M.A.R.T. Extra Options is the try I was talking about when I saw that smartd.conf was using -d removable -n never which according to the documentation of smartd (see here -n POWERMODE ) could explain why the drives are spinning up on every S.M.A.R.T. read.

[ATA only] Specifies if smartctl should exit before performing any checks when the device is in a low-power mode. It may be used to prevent a disk from being spun-up by smartctl. The power mode is ignored by default. A nonzero exit status is returned if the device is in one of the specified low-power modes (see RETURN VALUES below).

Note: If this option is used it may also be necessary to specify the device type with the '-d' option. Otherwise the device may spin up due to commands issued during device type autodetection.

The valid arguments to this option are:

never - check the device always, but print the power mode if '-i' is specified.

standby - check the device unless it is in SLEEP or STANDBY mode. In these modes most disks are not spinning, so if you want to prevent a disk from spinning up, this is probably what you want.
-n never in smartd.conf, the 5 minutes marks and the fact that spindown does not detect I/O before the spin ups all concur towards the fact that smart readings are spinning up my drives.

As I understand the doc, -n powermode may not produce identical results on different drives. When doing S.M.A.R.T reading by hand with -d atacam -n standby though, it did not spun the drives (whereas it did every time I didn't set -d atacam -n standby or when I ommitted -d atam which means smartctl needed to spin up the drive to guess the drive type).

I guess this is what the option Force HDD Standby is for (and it matches the helper tooltip), but it isn't working either (and you can't set that checkbox without specifying a spin down timer anyway).

I'm curious: could you post an excerpt of your /usr/local/etc/smard.conf to see if either device types or no check are set ? I'm beginning to think that this could be a bug a in TrueNAS, where it would not set smartd options correctly, forcing the -d removable -n never which was proven to wake up the disks on my system when doing S.M.A.R.T. reads.

 

ngandrass

Member
Joined
Jun 26, 2019
Messages
45
First of all please excuse the long time it takes for me to answer as well as my brevity. The last days have been quite busy...

I tried the same options as you showed here and it didn't change a thing. The spindown scripts does not detect I/O before a wakeup. The wakeups being on the 5 minutes marks, I'm pretty sure the issue lies within S.M.A.R.T. readings (see below).
Yes, sound definitely S.M.A.R.T. related to me too.

I'm curious: could you post an excerpt of your /usr/local/etc/smard.conf to see if either device types or no check are set ?
Here you go. It is identical for all drives in that pool.
Code:
/dev/ada0 -a -d removable -n standby -W 0,0,0 -m root -M exec /usr/local/libexec/smart_alert.py 

So maybe setting the "-n standby" option should fix it for you :)
 

blemasle

Junior Member
Joined
Mar 1, 2021
Messages
13
First of all please excuse the long time it takes for me to answer as well as my brevity. The last days have been quite busy...
No worries, I can fully relate to that (as you see by my own response time).

Here you go. It is identical for all drives in that pool.
Code:
/dev/ada0 -a -d removable -n standby -W 0,0,0 -m root -M exec /usr/local/libexec/smart_alert.py 

So maybe setting the "-n standby" option should fix it for you :)
Yeah, it definitly sounds like it could solve my issue. The trouble is, to set that option you need to check Force HDD Standby in the drive configuration which requires you to set a HDD Standby timer (and you expressly advised against it in your readme).

I'll give it another shot and see how the drives respond to that.

EDIT : and it turns out that checking that box does not change the smartd.conf value (it is still -n never)
 
Last edited:

blemasle

Junior Member
Joined
Mar 1, 2021
Messages
13
I think there is something wrong with some changes on TrueNAS 12
I sum it up in another thread, hoping to get some TrueNAS dev attention.

By the way, If I catch the intent behind that PR right, I cannot see why your script might still be required as that update also use iostats do decide when to spin down the drives.
 

ngandrass

Member
Joined
Jun 26, 2019
Messages
45
I think there is something wrong with some changes on TrueNAS 12
I sum it up in another thread, hoping to get some TrueNAS dev attention.

By the way, If I catch the intent behind that PR right, I cannot see why your script might still be required as that update also use iostats do decide when to spin down the drives.
Hey,

thank you for all the effort you put into this topic, it is very much appreciated! :)

Let's see how the TrueNAS developers react to your post. And if the update finally fixes the long present spindown issues with TrueNAS that would be fantastic. This would IMHO greatly improve the experience for small-scale home users.
 

Alex728

Newbie
Joined
Mar 11, 2021
Messages
3
Привет. Truenas 12. В моем пуле четыре диска. Заметил, что диски раскручиваются каждые 5 минут. (Как было сказано выше, это температурный опрос). но раскручиваются только три (2 seagate и toshiba) и wd остается спать. это происходит при использовании скрипта, такая же ситуация при использовании настроек в truenas. возможно hdd не поддерживается. hdd довольно старый. (Гугл переводчик)

[moderator note: This is an English language forum. Please post in English. We do have foreign language forums available as well. Translation of message follows. -jg]

Hello. Truenas 12. My pool has four disks. I noticed that the discs spin up every 5 minutes. (As mentioned above, this is a temperature survey). but only three unwind (2 seagate and toshiba) and wd stays to sleep. this happens when using a script, the same situation when using settings in truenas. maybe hdd is not supported. hdd is pretty old. (Google translator)
 
Last edited by a moderator:

blemasle

Junior Member
Joined
Mar 1, 2021
Messages
13
Привет. Truenas 12. В моем пуле четыре диска. Заметил, что диски раскручиваются каждые 5 минут. (Как было сказано выше, это температурный опрос). но раскручиваются только три (2 seagate и toshiba) и wd остается спать. это происходит при использовании скрипта, такая же ситуация при использовании настроек в truenas. возможно hdd не поддерживается. hdd довольно старый. (Гугл переводчик)

[moderator note: This is an English language forum. Please post in English. We do have foreign language forums available as well. Translation of message follows. -jg]

Hello. Truenas 12. My pool has four disks. I noticed that the discs spin up every 5 minutes. (As mentioned above, this is a temperature survey). but only three unwind (2 seagate and toshiba) and wd stays to sleep. this happens when using a script, the same situation when using settings in truenas. maybe hdd is not supported. hdd is pretty old. (Google translator)
My disks are Toshiba also. Their may be some manufacturer differences that makes some brands drives wake up and some others not. I suggest you report your case on the thread I opened. I think it is not up to ngandrass nor to its scripts to solve an issue that is more probably related to TrueNAS itself.
 

blemasle

Junior Member
Joined
Mar 1, 2021
Messages
13

ngandrass

Member
Joined
Jun 26, 2019
Messages
45
Top