sobota, dubna 16, 2011

Turn off hard disk power saving

I've had troubles to turn off the power saving mode of a hard drive. Nothing I tried worked. I have found descriptions of where to switch off the stand by mode or the sleep mode of hard drives or external USB devices, but these settings had no effect on the hard drive I had (Samsung Story HX-DE020EB).

I have found two programs which were supposed to keep the hard drive awake and spinning: NoSleepHD and xSleep. I tried both and none of them worked properly with my particular external hard drive. It still was getting asleep once in a while.

So I wrote myself a little program which creates as many temporary files as you want (each a few bytes long) in specified locations and overwrites them once in a specified time interval. This way it is ensured that the drives keep spinning.

The program runs only in Windows. You can download it here:
keepawake.zip for 64-bit Windows
keepawake32.zip for 32-bit Windows

User's Manual:

Extract the downloaded zip file. Then you should have a look at the configuration file keepawake.cfg.txt. By default it looks like this:

How often to overwrite all temporary files (in seconds):
40
Paths to the temporary files (one path per line):
C:\temp.tmp

By editing the configuration file you can set up the interval how often the program will overwrite each file in the list of temporary files. The default cycle is 40 seconds.

The last lines of the configuration file are the paths to the temporary files which will be created or overwritten once per cycle. You can add as many as you want here. One temp file per physical drive is enough. If you want to keep drives I: and J: awake, instead of C:\temp.tmp you can have there:

I:\temp.tmp
J:\some folder\I don't want to call this file temp.tmp

It is even possible to add network paths, e.g. \\Homecomputer\datadrive\temp.tmp

Then you just run keepawake.exe. The console window of cmd.exe will open and, in the given time interval, it will refresh a message about how long the drive has been kept alert. You'll have to keep this console window open or minimized for all the time you want to keep the program running.

This is how the console window looks on my computer:

screenshot of keepawake running

You will find the source code of the program in the source folder. It's written in Python 3.2. It's public domain. Do with it whatever you want.

13 komentářů:

derty2 řekl(a)...

Thankyou for this tool +++++

Please explain a little more for the user... What to do now with this black console window running on my desktop ?
If I close it, is your program still working ? Must it stay showing all the time ?

derty2 řekl(a)...

Sorry for double post...

Is it OK to add multiple paths into config file ?

example:
--------------
How often to overwrite the temporary file (in seconds):
40
Path to the temporary file:
I:\temp.tmp
J:\temp.tmp
-----------------------

Sven Siegmund řekl(a)...

The program is written in a way that this console window has to be opened (or minimalized) all the time. When you close it, the program will be interrupted (and won't delete the temp file after its termination).

Also, right now, if you want to keep two drives spinning you would have to have two copies of the .exe and .cfg file, each in a separate folder. Then you write I:\temp.tmp into one .cfg file, and J:\temp.tmp into another and execute both keepawake.exe individually.

However, I will modify the program and upload a new version soon, which will allow you to keep multiple drives awake in one program instance.

Sven Siegmund řekl(a)...

The program is now updated. You can add as many paths to the configuration file as you want. See the new User's manual for info.

derty2 řekl(a)...

Thanks for updating Sven ++++++

Your tool is nearly perfect...

If it was possible to minimize to System Tray (with pop-up information at mouse hover),
then your tool would definitely be THE BEST tool ever made for this task.

Thanks again for all your work.

derty2 řekl(a)...

Hi Sven, are you still with us ?
I have a problem...
keepawake.exe does not want to start anymore !!!

I get this Windows error message:
"This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem."

I have seen this exact message from a few other programs too.

Am I missing some dependency/library in my system?

I am running Windows XP w/ SP3.

Sven Siegmund řekl(a)...

That is strange. Let me look into it. I have tried it in Windows 7 only, but I will see how it can run in Windows XP. Did you try to download and run the 32bit version? With Windows XP you are likely to have a 32 bit system, rather than 64 bit.

Sven Siegmund řekl(a)...

Hi derty2

I have finally found some time to look into this on a Windows XP SP3 computer but I have found no issues at all. When you download the 32-bit version, all works fine.

Anonymní řekl(a)...

THANK YOU SO MUCH!!!

i was googling for hours...
the sleep/stanby is so annoying while just want to go to my media drive and select a MP3, worse thing is when you just want to save a file from whereever to wherever and that thing have to wake up again...YOU SAVED ME!!!

To finish it there should be indeed in the System Tray then its 100% perfect now it is 99.9%;)

Thanks again for this, much appriciated, saw your site a bit true must be more English:D:D:D

Minimise toSystray řekl(a)...

Thank you for your helpful app, Sven Siegmund.
To minimise it to the system tray instead of the task bar you can use small freeware apps or shareware with more comprehensive options:
http://www.bing.com/search?q=minimize+any+app+to+system+tray+windows+7

Anonymní řekl(a)...

Thank you so much for this timesaving little tool. I've been tampering with my system configuration to be able to disable sleep/standby on the ext. drives, but with no luck. I stumbled across your site, gave your program a shot and voila! Works perfectly. Also with network paths! Thank you so much my friend! ;)

Иван Мон řekl(a)...

Thank you, great tool.
It would be nice if the program to add some features:
1. If the path is not available, the utility will enter standby mode, and periodically makes attempts to connect according to a timer.
2. Add a check mark to add the program to the startup.
3. Stealth mode, as a service or daemon is minimized to tray or even invisible. Just quiet operation and nothing more.

P.S. Sorry my english, it's a google translate.

Иван Мон řekl(a)...

The program should not be closed if the path is not available, but simply must wait until the device turns on again and try to make the connection according to the timer. You can take it as a basis to create a second utility, in which it will be possible to have the installer, Gui, and something else ... It seems to me that you can even make a 15 day trial version.
A full version of the program to add the definition of hard drives going. The program will access the hard drives are not on file paths, and on the id, will seek partition with a file ka.log. Write there some logs.