The background for my question is - I've upgraded memory on my laptop (ASUS K75VJ) from 8GB to 16GB. Now with hibernation enabled - 12GB of disk space is taken by hiberfil.sys on my C: drive of SSD disk (what is really not OK) and additionally to that now it takes even more time to resume from Hibernated state (30+ seconds, typically closer to 1 minute, from SSD drive and with i7 CPU - clean boot runs in less than 15 secs).
I'm pretty much sure my laptop can live in Sleep state rather long (week or so …), that is why I've disabled hibernation, but after manually putting computer into sleep at the evening at the morning I've found that windows just performed shutdown of itself after 4 hours 15 minutes of sleep (according to Windows system log).
With hibernation enabled, system normally wakes up itself from sleep after same 4 hours 15 minutes and performs hibernation, but it appears that with hibernation disabled it rather just shuts down with all my running Apps losing their work - and this is absolutely wrong.
The questions are:
- Is it possible to disable that wakeup after 4 hours 15 minutes?
- Is it possible to at least make interval more reasonable, for example 12-24 hours? After putting laptop to sleep at the evening I do not want to neither start from scratch by starting clean windows session nor wait 1 minute to resume from hibernate
- Any way to prevent automatic shutdown during sleep?
My self-diagnostics so far shows the following:
Interval from putting into Sleep to Auto-Wake-Up for Shutdown/Hibernate is ~4:15 – copy/paste of 3 records from System event log
Sleep Time: 2016-05-12T14:33:50.019310900Z Wake Time: 2016-05-12T18:45:34.841004500Z
Sleep Time: 2016-05-12T09:14:51.924229400Z Wake Time: 2016-05-12T13:26:50.888176200Z
Sleep Time: 2016-05-11T22:02:26.772657800Z Wake Time: 2016-05-12T02:14:14.856077600Z
Wake Source: Unknown
Automatic wakeup from sleep (state S3) to perform hibernation (state S4) is most probably ‘by design’, though I could not find any reasonable spec in the regard, the closest one is here with not enough details - https://msdn.microsoft.com/en-us/library/windows/desktop/aa373229(v=vs.85).aspx
- In my configuration i have Sleep > Allow wake timers = Disable – for all power plans in Power Options (I did not change them)
- Some people recommend disabling S3 state in BIOS and enabling S2 instead, but BIOS in my laptop just do not have any relevant configuration :(
- it appears that after this 'resume from sleep' event in Windows System log
Message: The system has resumed from sleep ...
... 7-8 seconds later appears this event (with '/hibernate on')
Message: The system is entering sleep. Sleep Reason: Application API
... or (with '/hibernate off'):
Message: The kernel power manager has initiated a shutdown transition.
Unfortunately this information also does not reveal anything helpful to me.
I've tried to make dirty hack-workaround for this - be 'the first' to wake laptop and put it to sleep manually, but finally that attempt did not work.
major idea - capture the 'sleep' event via schedule task on Kerner-Power event #42 in system event log and schedule an action which wakes up the laptop in 3 hours (earlier than windows will wake up to hibernate), but ... it appears that when I press 'sleep' button laptop sleeps earlier than scheduled task captures that event - it is actually triggered 'after' laptop wakes up manually, not before sleep
Ok, it is not a problem to put to sleep via shortcut, but ... it seems there is no good way to put laptop again into sleep. I tried to schedule a task which runs 5 minutes after wake up and if laptop is idle for 1 minute (i.e. I did not wake it up manually), but that task is just not triggered (I've specified to start screensaver after 1 minute of inactivity). And that is the problem.
Plus there are some pitfalls with all this:
Native way to put computer to sleep
%windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Standbyactually hibernates if hibernation is enabled. This point is fixed by 3rd party tool 'nircmd.exe standby'
Setting the time of the scheduled task via SchTasks.exe has some peculiarity - its 'date' format is different for SYSTEM (mm/dd/yyy) and 'current user' (dd/mm/yyyy), therefore testing from command line is not the same as running from scheduled tasks under SYSTEM account. Have to always run scheduled tasks manually to test the result.