You are not logged in.

#1 2012-03-31 13:20:45

Nanthiel
Member
From: Slovenia
Registered: 2009-09-20
Posts: 148

[Solved] Hard drive spin-down/spin-up

Hello everyone,

the problem I have is that whenever the hard drive is spun down, it gets spun up immediately after. This makes spinning it down useless and potentially damaging.

According to my »research«, this is being caused by syslog-ng. I don't want to permanently kill the deamon, but I want it to respect my /proc/sys/vm settings and not flush() or sync() or any of that nonsense every time.

I run on a laptop and I don't believe I will get data loss due to power failure. Also, my data is not very important anyway. And with 8 GB of RAM, there's plenty to go around.

How I test this:

(1) I run hdparm -y /dev/sda, hear the drive spin down, and it spins up immediately thereafter.
(2) I run killall syslog-ng. And then hdparm -y /dev/sda. The drive spins down and stays this way until I actually access it.

I hope my assumptions have been correct. Guides mention a syslog.conf file, but it is nowhere to be seen. If I understand correctly, syslog-ng has a different configuration scheme. Maybe in /etc/syslog-ng/syslog-ng.conf? The flush_lines(N) option? I don't know how to edit it properly. What do I change it to?

Also, I don't know how to diagnose what is actually being logged all the time? It's not in dmesg. I mount my drives with the noatime option.


Thank you for your time and help, Nanthiel


(Edit) In addition, what hdparm -S setting would you recommend? My /proc/sys/vm/dirty_(expire|writeback)* options are at 60000 (I hope this means 10 minutes). The hdparm -S option is currently at 120, meaning 10 minutes.

Do you use acpid to automatically trigger events? Or do you just »go with it« and use the same settings on battery and AC?

I have used laptop-mode until yesterday, but I wanted to take control over these things.

Last edited by Nanthiel (2012-03-31 22:02:30)

Offline

#2 2012-03-31 14:33:44

adamrehard
Member
From: NY, USA
Registered: 2011-11-03
Posts: 154

Re: [Solved] Hard drive spin-down/spin-up

Read https://wiki.archlinux.org/index.php/Syslog-ng. As for log files, look in /var/log . You might want to consider searching before asking, and you will find people are more willing to help. (We all have to learn this someway) I can't comment on anything involving hdparm settings, as I don't own a laptop.


"The box said requires Vista or better, so I installed Arch"
Windows != Linux

Offline

#3 2012-03-31 17:24:34

Nanthiel
Member
From: Slovenia
Registered: 2009-09-20
Posts: 148

Re: [Solved] Hard drive spin-down/spin-up

Thanks for your reply.

After some more meddling, I'm confused. Turns out the disk spins up again even if syslog-ng isn't running. I found this out after trying it a couple more times and use ridiculous values for flush_lines and flush_timeout. It must have been a coincidence before.

Now, I echoed 1 to /proc/sys/vm/block_dump and was watching dmesg. Turns out the jbd2 process and flushing are causing wakeups. If I'm not mistaken, this is the journaling system for ext4. But why the flushing when I'm not using the disk?!

Does anyone know how to stop it? I have searched Google but nothing useful comes up, just people asking for a solution.

Offline

#4 2012-03-31 17:50:26

bohoomil
Member
Registered: 2010-09-04
Posts: 2,376
Website

Re: [Solved] Hard drive spin-down/spin-up

Nanthiel wrote:

Does anyone know how to stop it?

Try adding 'noatime' option to /etc/fstab. Check also another one: commit=60.

Last edited by bohoomil (2012-03-31 17:51:10)


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#5 2012-03-31 18:06:16

Nanthiel
Member
From: Slovenia
Registered: 2009-09-20
Posts: 148

Re: [Solved] Hard drive spin-down/spin-up

I'm already using noatime. Will try commit, is it bad if I set it even higher, like 300?

Also, how could I stop the disk from spindown altogether? (Not spinup this time.)
Thing is, currently spinning down is useless for me because it immediately spins up. Even during a game, I get weird disk lag because it spins down even during use! I don't understand it at all.

My hdparm -B is 254, hdparm -S 120. It should not be spinning down automatically (especially during use), but it is. And it makes a disturbing clicking sound when it does that.

Offline

#6 2012-03-31 18:10:11

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [Solved] Hard drive spin-down/spin-up

Nanthiel wrote:

And it makes a disturbing clicking sound when it does that.

If it's the sound of the heads parking/unparking (i.e. moving to a safe zone), then it's perfectly normal.

Offline

#7 2012-03-31 18:12:51

bohoomil
Member
Registered: 2010-09-04
Posts: 2,376
Website

Re: [Solved] Hard drive spin-down/spin-up

My hdparm -S is set to 243, which combined with -B 254 makes no clicks here.


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#8 2012-03-31 18:20:33

Nanthiel
Member
From: Slovenia
Registered: 2009-09-20
Posts: 148

Re: [Solved] Hard drive spin-down/spin-up

Setting commit=600 stopped the immediate waking up after a hdparm -y! Combined with slightly tuned syslog-ng settings, it seems to work perfectly now.

I _think_ it is the sound of heads parking/unparking. I've not owned a proper laptop before so I can't be sure. My EeePC was completely silent all the time.

So, the original problem has been solved now. But I would like to know how to stop the spindown completely. Even with hdparm -B 255 it still spins down during Heroes of Newerth, making the clicking sound. And at the same time, the game stops for a moment. I will post more information as I go by. After changing these settings, this might have been solved as well. I don't have time to test this at this moment, as Earth Hour is coming and I'm going out for a while!

Marking as solved. Thanks everyone!

Offline

#9 2012-03-31 22:04:51

Nanthiel
Member
From: Slovenia
Registered: 2009-09-20
Posts: 148

Re: [Solved] Hard drive spin-down/spin-up

There is something odd I noticed. With hdparm -B 254 and 255, the clicks are infrequent but very loud. With 253 and below, they are considerably more frequent but can almost not be heard. Load_Cycle_Count, as reported by smartctl, increases by 1 in each case, no other counts change. Is it possible that the significantly louder clicks damage the drive more?

Offline

#10 2012-03-31 22:33:25

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [Solved] Hard drive spin-down/spin-up

Why do you keep talking about damage? The heads aren't slamming into the case, shouting "let me out!"

They are designed to do this.

As speculation, 253 might be keeping the head nearer the edge of the disk, for safety, Less space to travel, for parking, probably equals less noise and quicker parking, but a longer average seek time for r/w.

Edit: Got numbers confused.

Last edited by brebs (2012-03-31 22:52:01)

Offline

#11 2012-03-31 22:46:21

Nanthiel
Member
From: Slovenia
Registered: 2009-09-20
Posts: 148

Re: [Solved] Hard drive spin-down/spin-up

I guess I might be too worried. But the sound 254 and 255 make is kinda scary, compared to 253 and below, which can barely be heard.

Did you mean 253 was keeping the heads nearer to the edge?

Offline

#12 2012-03-31 22:55:44

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [Solved] Hard drive spin-down/spin-up

Oops, yeah, 253.

According to "man hdparm", 254 & 255 favour I/O performance (might in reality be doing exactly the same thing), so that tallies with my speculation.

I've had some performance-oriented drives in my old desktop that sounded like an angry hornets nest, during r/w.

Last edited by brebs (2012-03-31 22:58:02)

Offline

#13 2012-03-31 23:16:09

thisoldman
Member
From: Pittsburgh
Registered: 2009-04-25
Posts: 1,172

Re: [Solved] Hard drive spin-down/spin-up

If your drives have acoustic management, you can see if setting it makes a difference: https://bbs.archlinux.org/viewtopic.php … 5#p1063185.

There's probably a performance hit, but it's unnoticeable by me.  An unverified explanation is that the setting controls the seek velocity of the heads.

Offline

#14 2012-04-01 01:04:46

Nanthiel
Member
From: Slovenia
Registered: 2009-09-20
Posts: 148

Re: [Solved] Hard drive spin-down/spin-up

I'm sorry to say that my drive doesn't support acoustic management. I don't think it would affect the clicking though.

Interestingly, there is a noticable difference here between -B 254 and 255. In terms of how often the clicks occur.

I don't think I will be able to permanently remove them. I have the option of making them silent but frequent, or loud and infrequent. My only criterion is disk health, for which I'm not sure which is better.

Offline

#15 2012-04-01 08:17:54

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [Solved] Hard drive spin-down/spin-up

Nanthiel wrote:

My only criterion is disk health

Being parked is safest. So go with "silent but frequent".

254 is the usual choice, I believe.

Offline

#16 2012-04-01 08:33:24

Nanthiel
Member
From: Slovenia
Registered: 2009-09-20
Posts: 148

Re: [Solved] Hard drive spin-down/spin-up

254 isn't silent though. 253 and below is. I will measure the frequency of 253 and post it here.

254 causes about 50--100 landings on an average day.

Offline

#17 2012-04-02 13:05:16

Nanthiel
Member
From: Slovenia
Registered: 2009-09-20
Posts: 148

Re: [Solved] Hard drive spin-down/spin-up

Turns out 253 causes 50--100 landings in an HOUR. Pretty drastic difference, and I consider it to be too much. I never move the machine during use anyway.

Offline

Board footer

Powered by FluxBB