ngandrass / truenas-spindown-timer

Monitors drive I/O and forces HDD spindown after a given idle period. Resistant to S.M.A.R.T. reads.
MIT License
276 stars 28 forks source link

TrueNAS support? #4

Closed supra89t closed 3 years ago

supra89t commented 4 years ago

Hello!

From my understanding FreeNAS will become TrueNAS core edition. I have the beta installed on a test machine and installed the script and it will not spin down the drives. Will you be testing and implementing your script for TrueNAS?

I'm available for testing if you need a guinea pig!

They do spin down, but they spin right back up.

SSD Script Smart

da16 is my USB boot drive, ada0/1 are my SSD's for the script and other small files in the future. ada7 is the cache drive for the 15 HDD's (the motherboard only supports 32GB ram)

root@truenas-cold[~]# cd .. root@truenas-cold[/]# cd mnt/SSD/Scripts root@truenas-cold[/mnt/SSD/Scripts]# bash spindown_timer.sh -t 1800 -p 600 -i da16 -i da7 -i ada0 -i ada1 Monitoring drives with a timeout of 1800 seconds: da13 da12 da11 da10 da15 da14da0 da1 da2 da3 da4 da5 da6 da8 da9 I/O check sample period: 600 sec camcontrol: Unable to get ATA CHECK POWER MODE result 2020-09-06 12:08:45 Spun down idle drive: da13 camcontrol: Unable to get ATA CHECK POWER MODE result 2020-09-06 12:08:46 Spun down idle drive: da12 camcontrol: Unable to get ATA CHECK POWER MODE result 2020-09-06 12:08:47 Spun down idle drive: da11 camcontrol: Unable to get ATA CHECK POWER MODE result 2020-09-06 12:08:47 Spun down idle drive: da10 camcontrol: Unable to get ATA CHECK POWER MODE result 2020-09-06 12:08:48 Spun down idle drive: da15 camcontrol: Unable to get ATA CHECK POWER MODE result 2020-09-06 12:08:48 Spun down idle drive: da14 camcontrol: Unable to get ATA CHECK POWER MODE result 2020-09-06 12:08:49 Spun down idle drive: da0 camcontrol: Unable to get ATA CHECK POWER MODE result 2020-09-06 12:08:50 Spun down idle drive: da1 camcontrol: Unable to get ATA CHECK POWER MODE result 2020-09-06 12:08:50 Spun down idle drive: da2 camcontrol: Unable to get ATA CHECK POWER MODE result 2020-09-06 12:08:51 Spun down idle drive: da3 camcontrol: Unable to get ATA CHECK POWER MODE result 2020-09-06 12:08:51 Spun down idle drive: da4 camcontrol: Unable to get ATA CHECK POWER MODE result 2020-09-06 12:08:52 Spun down idle drive: da5

supra89t commented 4 years ago

I swapped out some HBA cards for 2 others and its working, the drives spindown and stay down. Perhaps its a driver issue since I just tested with FreeNAS and the same issue was present. Cards were DELL H740P and I had 2 of them in the system. Replaced them with LSI 9211's and the issue is fixed.

ngandrass commented 4 years ago

Excuse my delayed response. The last days were quite busy ;)

From my understanding FreeNAS will become TrueNAS core edition. [...] Will you be testing and implementing your script for TrueNAS?

Sure thing. If both FreeNAS and TrueNAS will merge into a single OS I'll test the script on TrueNAS and make adjustments if necessary.

Perhaps its a driver issue since I just tested with FreeNAS and the same issue was present.

The logs you provided look to me like camcontrol definitively has problems with these specific HBA cards...

Cards were DELL H740P and I had 2 of them in the system. Replaced them with LSI 9211's and the issue is fixed.

So it is working for you right now? Is using the LSI 9211's an option or do you need further debugging efforts with the DELL cards?

supra89t commented 4 years ago

Yes it is working now, I copied data to the drives. The cache drive does not go into sleep or spindown which is good cause it would defeat the purpose. Everything is working as it should.

As for the H740P's it would be amazing to have them work as they have 8GBs of cache on the cards with battery backups. Are you willing to help me troubleshoot them? I just need to move the data off of it back to its source, I was upgrading my Flash storage NAS (HP 380 Gen9 24xSSD's). The move back should not take too long, I should be free to test later this evening or tomorrow.

Thank you, J

ngandrass commented 4 years ago

I'm glad to hear that it is working for you, at least for the moment :)

Regarding the H740P's: I'd be happy to help but unfortunately currently don't have the spare time to help you with the troubleshooting. However... I can at least give you a point to start:

The logs look like there is a problem with camcontrol inside the drive_is_spinning() call inside the spindown_drive() function: https://github.com/ngandrass/freenas-spindown-timer/blob/master/spindown_timer.sh#L210

ngandrass commented 3 years ago

I recently upgraded my FreeNAS machine to TrueNAS-12.0 and was able to confirm that the script works :tada: 6946a06278707923373948cb6a5a2a3ec58dc41f

I'll therefore close this issue now. If you experience further problems with your H740P's feel free to open up another issue :)