LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Scheduling hard drive spin down (https://www.linuxquestions.org/questions/linux-newbie-8/scheduling-hard-drive-spin-down-904866/)

lonesoac0 09-24-2011 10:36 PM

Scheduling hard drive spin down
 
hello all,

I would like to know if I can schedule standby/sleep with crontab. I am specifically trying to spin down the hard drive for a while and then spin up the hard drive at a specified time. I found the command of
Code:

hdparm -y /dev/sda
but it does not look like it does anything. All I see it does is:
Quote:

/dev/sda:
issuing standby command
Any help would be appreciated!

rknichols 09-25-2011 10:03 AM

That's exactly what the output from hdparm should look like when it successfully spins down the drive. You were expecting something else??

In most cases you don't have to explicitly spin up the drive. The next time something tries to access the drive, the kernel will spin it up automagically.

TobiSGD 09-25-2011 10:07 AM

Quote:

Originally Posted by rknichols (Post 4481764)
The next time something tries to access the drive, the kernel will spin it up automagically.

And exactly that may be the case when the command doesn't work for you, may be a program accesses the disk when you try to spin it down (for example the syslog daemon).

lonesoac0 09-25-2011 10:39 AM

Daemons maybe why the command seemingly does not work then. I have lighttpd and samba running just to name a couple off of the top of my head. So, I need to figure out how to find all active processes, kill them, and then
Code:

hdparm -y /dev/sda
Right?

rknichols 09-25-2011 11:11 PM

Are you trying to spin down a drive that contains mounted file systems? It may be difficult to get that to "stick" -- too many things that can cause an access.

lonesoac0 09-26-2011 07:46 AM

yes, I am trying the command while both / and Swap are mounted.

Mr. Alex 09-26-2011 07:56 AM

Read `man hdparm` and see hdparm -S and hdparm -B. You won't need cron. But I don't recommend you to spin down your HDDs - it's bad for the motor.

lonesoac0 09-26-2011 04:19 PM

How in the world can spining down hard drives be bad for my monitor??

Mr. Alex 09-27-2011 03:57 AM

lonesoac0, please read more carefully what I wrote. It's "motor", not "monitor". I am talking about motor of HDD, it's better to keep it spinning constantly.

lonesoac0 09-28-2011 04:15 PM

Ahhhhh! Sorry about that! I will reconsider using hdparm since it could directly do the oposite of what I want. I want to try to place less strain on the hard drive not more.

Mr. Alex 09-29-2011 03:04 AM

Quote:

Originally Posted by lonesoac0 (Post 4484783)
I want to try to place less strain on the hard drive not more.

In this case you definitely should keep them spinning and not to turn off (unless you keep your PC off for 24 hours or more). And make sure HDDs are 35-45 °С. That is also important.


All times are GMT -5. The time now is 11:55 PM.