Putting external hard drives to sleep

NAS326, NAS520, NAS540, NAS542
Antworten
stainless
Beiträge: 12
Registriert: Mo 18. Nov 2019, 01:05

Putting external hard drives to sleep

Beitrag von stainless »

Hi,

i use two external hard drives on my NAS540 as storage expansion and as backup solution.
The backup drive only needs to run once a day. The storage one maybe once a week.
But the NAS does not put them into power savings mode. They spin all the time. Is there any way to do this?

Mijzelf
Beiträge: 113
Registriert: Mi 14. Nov 2018, 19:50

Re: Putting external hard drives to sleep

Beitrag von Mijzelf »

The firmware puts the disks into sleep, the daemon hdidle is responsible for that. But it is possible that the (sata) commands are not passed by the USB-SATA bridge.

You can try to use the 'USB Disk somnifacient' plugin for Tweaks. I remember that for someone that did something that the firmware didn't.

That plugin is switched off for fw 5+ (because of hdidle), but it's easy to switch on. In the file /i-data/sysvol/.PKG/Tweaks/gui/Tweaks/plugins/usbsleep.sh, put a # before line 18, '[ ${TWEAKS_FIRMWARE} -ge 500 ] && return 1', and restart Tweaks using the webinterface.

stainless
Beiträge: 12
Registriert: Mo 18. Nov 2019, 01:05

Re: Putting external hard drives to sleep

Beitrag von stainless »

Omg, it worked.

Thank you so much!


Edit: On little caveat: It also turns the other hard drives in the NAS off. Is there any way to prevent it from doing that?

Mijzelf
Beiträge: 113
Registriert: Mi 14. Nov 2018, 19:50

Re: Putting external hard drives to sleep

Beitrag von Mijzelf »

Maybe. It skips the number of disks which is handled by the firmware old style. In your case that is zero. You can hardcode that to 4 (or whatever number of disks you have) on line 206, change

local nrharddisk=` some shell command `

in

local nrharddisk=4


A problem could be if the usb disks are detected first. In that case you should skip the last disks, and not the first.

stainless
Beiträge: 12
Registriert: Mo 18. Nov 2019, 01:05

Re: Putting external hard drives to sleep

Beitrag von stainless »

Yeah, the USB ones are listed first unfortunately.
How would skip the 4 last ones?

Sorry, i'm not that familiar with shell scripts...

Would it be possible to hardcode the drives to monitor?
It's sda and sdb.

Mijzelf
Beiträge: 113
Registriert: Mi 14. Nov 2018, 19:50

Re: Putting external hard drives to sleep

Beitrag von Mijzelf »

Some lines below, there is the script which does the 'actual work'. Change here

for dev in \` $ls /sys/block/ | $grep sd \`

in

for dev in sda sdb

stainless
Beiträge: 12
Registriert: Mo 18. Nov 2019, 01:05

Re: Putting external hard drives to sleep

Beitrag von stainless »

Thansk Mijzelf, that did the trick!

Do you have some sort of donations? Since you helped me out twice now i would like to buy you a coffee / beer!
Also i saw you are the original developer behind those scripts! Cool! :)

Mijzelf
Beiträge: 113
Registriert: Mi 14. Nov 2018, 19:50

Re: Putting external hard drives to sleep

Beitrag von Mijzelf »

stainless hat geschrieben:Do you have some sort of donations? Since you helped me out twice now i would like to buy you a coffee / beer!
You get the same answer as ariek: https://homeforum.zyxel.com/discussion/ ... mment_7314

Antworten