Suspend (sleep or hibernate) when IDLE

Tell us your most wanted features from QNAP products.
iam@nas
Easy as a breeze
Posts: 267
Joined: Wed Jun 15, 2016 2:49 am

Re: Suspend (sleep or hibernate) when IDLE

Post by iam@nas »

@baconbrain: Cheching via ifconfig or /proc/net may work much better. I'd fetch the stats every minute unless QNAP already logs them somewhere. Fetching also CPU and disk I/O stats shouldn't hurt.
If the network I/O is getting below a certail value for n minutes I'd trigger standby, no matter whether the discs are still active indexing data. Of course one could also check disk I/O or CPU. I'd disable the HDD suspend completely.

Sending emails should cause a log entry by sendmail in /var/log/maillog and would explain why the disks spin up again. Creating an empty file before suspending would allow one to check for it within the script. And if it's there remove it and notify about the wake-up.
Pseudocode:
[ -f /tmp/going-to-suspend ] && rm -f /tmp/going-to-suspend && echo 'woke up'
[ no-network-io ] && touch /tmp/going-to-sleep && echo mem >/sys/power/state
baconbrain
Starting out
Posts: 18
Joined: Wed May 11, 2016 8:50 pm

Re: Suspend (sleep or hibernate) when IDLE

Post by baconbrain »

I like the idea but must admit my scripting skills are probably not at the level necessary to put something together that would actually work ...

Would it be to much to ask for you to post an example script similiar to what jsl24469 has done above?

Thanks in advance,

BB
jsl24469
New here
Posts: 8
Joined: Mon Mar 07, 2016 2:52 am

Re: Suspend (sleep or hibernate) when IDLE

Post by jsl24469 »

The script does indeed depend on your NAS' drives going to sleep. If disk activity is detected (meaning that the 'hdparm' command tells you that the drives are not in idle mode) it will not work. However, triggering an email _after_ idle status has been detected will likely add some content to log files, but the 'echo mem >/sys/power/state' line sends your NAS to hibernation mode - no matter what. Give it a try: log on via ssh, keep the NAS busy with some other tasks but then trigger the /sys/power/state command line. For my configuration, the NAS _always_ goes to hibernation mode - no matter what.

In order to avoid the drives from spinning up again, I may have to explore the option of copying the relevant commands to a ramdisk, omit hwclock update and mail stuff and execute them from there. This may or may not work - haven't tried it out yet. I still want to send the WHOLE NAS to sleep without the need of restarting the drives.

Checking the list of processes might be a viable option. The question is: How to define if the machine is idle or not? a good combination of ps, sar and other tools may be helpful. But in the end, I believe that disk activity may be the more reliable and/or only option. Anyway, I'm happy to listen to suggestions ;-)

Best,
Joerg
millahjovich
New here
Posts: 4
Joined: Thu Jun 23, 2016 6:01 pm

Re: Suspend (sleep or hibernate) when IDLE

Post by millahjovich »

I also like the idea of this as at the moment my QNAS is humming away to itself and using up power was no one using the device.
I also have looked around and I even through about the WLAN commend, but in doing this I through that I would be to mess, and if I can't find a ideal solution, I am considering on turning off the NAS as and when I am not using it, which would be a shame.
baconbrain
Starting out
Posts: 18
Joined: Wed May 11, 2016 8:50 pm

Re: Suspend (sleep or hibernate) when IDLE

Post by baconbrain »

Guys,

Was on the road for a couple of weeks and therefore didn't have the chance to respond. Thanks for the comments.

I don't want to do any brand bashing and realize that I have purchased a NAS which is intended to support small business's and maintaining a high level of availability, but I fail to understand why this (going into standby and then sleep mode) is so difficult for my QNAS when it works so well for my SNAS.

BB
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: Suspend (sleep or hibernate) when IDLE

Post by schumaku »

baconbrain wrote:I don't want to do any brand bashing and realize that I have purchased a NAS which is intended to support small business's and maintaining a high level of availability, but I fail to understand why this (going into standby and then sleep mode) is so difficult for my QNAS when it works so well for my SNAS.
Does S* support sleep and hibernate? Not really ...
HDD Hibernation, System Hibernation and Deep Sleep are types of energy-saving modes available on S* NAS and Expansion Units.
FMI: https://www.synology.com/en-global/know ... Deep_Sleep

System Hibernation is available on a hoping amount of two specific 2013 models only.
baconbrain
Starting out
Posts: 18
Joined: Wed May 11, 2016 8:50 pm

Re: Suspend (sleep or hibernate) when IDLE

Post by baconbrain »

Well then I guess I am just lucky because my DS-412+ seems to go into System Hibernation without a problem. It has worked that way from the beginning and continues to work after numerous updates.

Honestly, I would be happy if at least the HDD Spindown on my 471 would work without having to turn off almost every service / application. Joerg's work-around above (thx again) for putting the NAS to sleep can do the rest. I wouldn't want to bother the QNAP developers with something so trivial ... :wink:
ja666
Know my way around
Posts: 186
Joined: Sat Nov 29, 2014 5:21 pm

Re: Auto Hibernate/Sleep

Post by ja666 »

Biatsch wrote:i want the nas in sleepmode (so the nas isnt pingable but should fast awake via macadress ;)) In the german Forum someone wrote an qpkg but it isnt shared anymore ;((( http://forum.qnapclub.de/viewtopic.php? ... t=shutdown So it seems there is no one out who can program a function like that...... (check if some ips are not pingable and a samba share is not used to get the nas into sleepmode)?????
If you have QFinder Pro installed on your remote, you can easily send sleep, restart, remote wake-up (wake on LAN) or shut down device commands to your QNAP NAS.
ja666
Know my way around
Posts: 186
Joined: Sat Nov 29, 2014 5:21 pm

[Wanted] Auto-Sleep Mode

Post by ja666 »

I'd gladly welcome auto-sleep mode of my QNAP NAS, after user (admin) menu preset time of un-activity. The reason is to conserve energy. No need to power the device 24/7. Sleeping from QFinder Pro is difficult, as you never know if you are the 'last' remote computer user going to bed/home/party.
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: Suspend (sleep or hibernate) when IDLE

Post by schumaku »

Moderation note: Similar feature request threads merged.
pilaQ
Starting out
Posts: 18
Joined: Sat Nov 12, 2016 9:41 pm

Re: Suspend (sleep or hibernate) when IDLE

Post by pilaQ »

To let us wake NAS from S3 sleep mode with WOL, QNAP introduced ability to 1) send NAS to (hybernation) S3 sleep via main menu, and 2) we can create Powe Schedule to make it sleep at fixed times.

Obviously the only missing thing here in the menus is: 3) NAS S3 sleep after set period of disk inactivity. Asustor has done it perfectly well, adding to all of the above: 4) press the power button to make it sleep.

For now, the best we can do is to set disks to go to sleep, then cron check if disks are idle, and then send NAS manually to hybernation (sleep).

But, problem is with latest 3 fw versions (at least for my NAS) is that it has bugs preventing Disk sleep/suspend. It generates almost 1 GB Interet traffic without a reason as I demonstrated in another post.
jsl24469
New here
Posts: 8
Joined: Mon Mar 07, 2016 2:52 am

Re: Suspend (sleep or hibernate) when IDLE

Post by jsl24469 »

pilaQ wrote:But, problem is with latest 3 fw versions (at least for my NAS) is that it has bugs preventing Disk sleep/suspend. It generates almost 1 GB Interet traffic without a reason as I demonstrated in another post.
Hmm, I don't experience this behavior though my NAS is running the latest firmware. As before, the NAS still gets sent to hibernation mode whenever the predefined idle time has been exceeded. Apart from the standard services, Time Machine support and a local perl/Mono installation, the device does not host any other services, though. So you might want to uninstall all software until you find the process that is causing this issue - or reinstall the NAS from scratch.

FWIW, I still haven't found out how to calculate the moment when the hard drives are close to switching to idle mode. Nevertheless, I'd love seeing a feature like this officially supported by QNAP (along with 2FA and PAM authentication for the SSH access). Using that workaround of mine is fine, but I'd rather see it properly implemented as part of the official firmware.
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: Suspend (sleep or hibernate) when IDLE

Post by schumaku »

pilaQ wrote:But, problem is with latest 3 fw versions (at least for my NAS) is that it has bugs preventing Disk sleep/suspend. It generates almost 1 GB Interet traffic without a reason as I demonstrated in another post.
All off-topic in this feature request.
jsl24469 wrote:Hmm, I don't experience this behavior though my NAS is running the latest firmware.
Yes, ie. the TS-x69 as per the forum profile (as well as all "home" or "CAT1" x86 NAS models, all Marvell Kirkwood NAS models, don't come with the Network & Virtual Switch App for the network management.
jsl24469 wrote:So you might want to uninstall all software until you find the process that is causing this issue - or reinstall the NAS from scratch.
this might be the way to discover the suspect guilty ones - like DOnwlod Station, other BitTorrent App, any kind of cloud backup, or simply a cracked/hacked and abused NAS.
pilaQ
Starting out
Posts: 18
Joined: Sat Nov 12, 2016 9:41 pm

Re: Suspend (sleep or hibernate) when IDLE

Post by pilaQ »

schumaku wrote:
pilaQ wrote:But, problem is with latest 3 fw versions (at least for my NAS) is that it has bugs preventing Disk sleep/suspend. It generates almost 1 GB Interet traffic without a reason as I demonstrated in another post.
All off-topic in this feature request.
And you claim that 1 GB in unsolicitated Internet traffic per month genrated by NAS for no good reason does not influence writing to disks? Pointless constant writing do disks. Think again. This is absolutely related and much easier to check for and to find offenders.
pilaQ
Starting out
Posts: 18
Joined: Sat Nov 12, 2016 9:41 pm

Re: Suspend (sleep or hibernate) when IDLE

Post by pilaQ »

jsl24469 wrote:
pilaQ wrote:But, problem is with latest 3 fw versions (at least for my NAS) is that it has bugs preventing Disk sleep/suspend. It generates almost 1 GB Interet traffic without a reason as I demonstrated in another post.
Hmm, I don't experience this behavior though my NAS is running the latest firmware. As before, the NAS still gets sent to hibernation mode whenever the predefined idle time has been exceeded. Apart from the standard services, Time Machine support and a local perl/Mono installation, the device does not host any other services, though. So you might want to uninstall all software until you find the process that is causing this issue - or reinstall the NAS from scratch.
In the meantime, I got another QNAP TS-253A, so I am experimenting on an inactive NAS. I have had Surveillance station, Virtualisation station and Download station generating disk requests needlesly. The last one generated tremendous amount of Internet traffic just by being installed, and never even opened or used! All 3 of these apps were empty, absolutely nothing was in them and no reason to go to the Internet or bungee onto disks. They were accesing disks in every less than 2 minutes! I uninstalled all 3 apps, and now disks are going to standby perfectly fine. Checking the Internet traffic from the NAS might be used to see which apps are doing what they should not be doing.

It would be beneficial if we were all to use the correct terms. Disks after some time of inactivity, as set in GUI, on my QNAP TS-253A go to standby mode. We use that fact to send entire NAS to S3 sleep mode. So, better to avoid other terms as they are wrong and may confuse us. Disks go to standby and NAS to S3 Sleep from which we wake it up with WOL. Disks can also go to a sleep mode.

If it may help someone, here is my recipe: disk are set to go to standby after 15 minutes of inactivity. A cron job checks every 20 minutes if disks are in standby, and if they are, sends NAS to S3 sleep. I did this:

1) Control Panel -> System settings -> Hardware -> Enable Hard disks standby mode - 15 minuta

2) ssh 2 NAS, and type these two lines:

Code: Select all

echo "*/20 * * * * hdparm -C /dev/sda | grep standby && echo mem > /sys/power/state" >> /etc/config/crontab

crontab /etc/config/crontab
I do not check single drives as it makes no sense on 2 bay NAS with RAID1. I do not know if some models send disks to sleep instead of standby, in which case the above command needs to be changed.

I installed Virtualisation (empty) station and Twonky, and it goes to suspend and S3 well. I use TS-X53A_20160901-4.2.2 fw. I will try now upgrading just fw to the latest version and report back.
Last edited by pilaQ on Sun Nov 27, 2016 6:12 pm, edited 3 times in total.
Post Reply

Return to “Features Wanted”