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!
Power saving
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.
Paradox
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 !!!
The problem
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.
Some numbers
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
What gives..
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.
Possible Solution
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.
Very interesting post. Looked around for expert opinions, but turns out the experts don't agree on anything, as usual.
I keep the power setting on my Dell (insprion 1525) Vista laptop to 'Power Saver' (which by default favours battery life over performance; yes yes, I know 'Vista Performance' is an oxymoron).
A quick check (via 'Control Panel' -> 'Power options' -> 'Change plan settings') indicates that the HDDs are turned off auto, after 5 minutes of inactivity when on battery and after 20 minutes when plugged in.
I'll scout for the equivalent of 'smartctl' for Vista and compare with your results. (If smartctl's results are not from the OS, but directly from the disk controller, I can boot my box into linux and run the same).
@sAgar
Hmm.. Vista's setting to turn it off after 5 mins of inactivity is not too bad.
Back of the envelope calculation, for worst case, is 100k reloads per year. Which means, even in the worst case, you might get about 6 years of HDD life.
But, that's only in software, check the actual hardware setting thus:
hdparm -I /dev/sda | grep "Advanced power management level"
smartctl indeed reads data off the disk controller (a SMART disk controller).
For my LT, smartctl (Windoze version) reports, among others:
Start_Stop_Count: 979
Power_On_Hours: 1184
Power_Cycle_Count: 674
Power-Off_Retract_Count: 282
Load_Cycle_Count: 34405 (that's a tenth of the value you see for your box)
YMMV ofcourse, especially if you have a different power option or have customised the power options. I am on 'Power Saver' for my inspiron 1525.
You are indeed better off, sAgar, congratulations! (To be sure, the absolute numbers can't be compared, as it depends on the individual HDD's max rating for reloads).
Your reloads per hour are (33405 / 1184.0) = ~ 30
Mine are 343830 / 3409.0 = ~ 100
Aside, I don' t think this should be colored as a vista v/s linux game, because the HDD manufacturer's power management features would also matter. To compare OSes we would have to use the same h/w for benchmarking (and under similar work loads, if you woke up pedantic today :-) ).
Macrocyclic metal super texture, light touching, stamping the brand LOGO, is not only unique, but also enhance the noble qualities of the moment http://www.salecheapbags.com
You can see the opening of the jerseys on nikenfljerseysstore.com