This is a rather technical post; non-techy readers can skip/skim. Also, my knowledge might be half-baked, since I haven't RTFC; just culled the info from mailing lists. You have been warned!
It all started with a simple wish: to save power on a server system I am building, by spinning down the HDD when the server has a prolonged idle time.
A quick googling revealed that "hdparm -S" was my friend. It helps set a timeout parameter for the disk to spin down and thus save power. So, I quickly setup a bootup script which does this, and that would have been the end of it, had it worked as expected.
I observed that the option does work for very small timeouts (5 to 10 seconds). But beyond that there is always some activity happening in the system that prevents the disk from spinning down, which was evidently a software configuration problem.
So, I started digging more on this topic, and figured a couple of tools to help pin down what are the exact applications that cause this background activity. (See for example, the Spinup Debugging section here)
But that is a different story. The real story is that I learnt that frequent spinning down was actually bad for the disk, and it was happening by default, without user intervention, on most Linux (and possibly Windoze) systems, on most Hard Drives !!!
Frequent spin ups & spin downs are bad because they cause wear & tear of the disk head mechanism, which is more than the wear & tear that happens while the disk is spinning.
To find out how many times the drives has been loaded (and hence spun up/down), use the smartctl command:
smartctl --all /dev/sda | grep Load_Cycle
On my laptop the output was,
smartctl --all /dev/sda | grep Load_Cycle 193 Load_Cycle_Count 0x0012 066 066 000 Old_age Always - 343830
The last number, 343830, gives the number of times my HDD was loaded, and that's a huge number given that it is only 1.5 years old. Typical maximum loads for a laptop HDD are about 600k.
The power on time for my disk is
smartctl --all /dev/sda | grep Hour 9 Power_On_Hours 0x0012 093 093 000 Old_age Always - 3409
The official answer is on the known issues page of the Linux ATA driver website. But this is a rather conservative assessment, IMO.
From my own experience and from what I have seen on various forums, there are many users with various different HDD makes, that are affected by this problem.
The cause for this high number of disk loads, AFAICT, is that most laptop HDDs have factory defaults that maximise power savings (to give longer battery life times). The aggressive power saving settings, however, cause frequent spin downs. And most linux distributions (and perhaps Windozers) don't change the factory settings unless instructed (which is a wise decision IMO).
The ways for avoiding this are also poorly documented.
The end result is that, by default most laptop disks could wear out in about 3 years of regular use.
One way to reduce the frequency of HDD loads is to use the "hdparm -B" option. A high number for the parameters value will tend to reduce the number of spin downs (and also consequently increase power consumption).
The exact way to do this on your distribution may vary. On my Fedora Box, I modified "/etc/rc.local" and stuck in this:
# prevent aggressive power management (-B 254) # set spin down timeout to 30 minutes of idle time (-S 241) hdparm -B 254 -S 241 /dev/sda
This has certainly reduced the number of spin downs for me.
Do let me know via comments if it works for you too.