LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   hdparm / APM / Hard Drive Clicking Sound (https://www.linuxquestions.org/questions/ubuntu-63/hdparm-apm-hard-drive-clicking-sound-588770/)

win32sux 10-01-2007 10:46 PM

hdparm / APM / Hard Drive Clicking Sound
 
SHORT VERSION

Anyone know where I could find some documentation explaining the -B option of hdparm and it's implications regarding hard disk shock resistance and wear and tear? Or perhaps you have an explanation of your own? The man page is quite limited. =/


LONG VERSION

I recently noticed a clicking sound coming from my laptop's (Ubuntu 7.04) hard drive every few seconds. Google showed me I was far from being alone - seems tons of GNU/Linux users have encountered this problem. It also seems to be a pretty dangerous thing, as AFAICT it eats away at the hard disk's life. FWIW, it's a confirmed issue in Ubuntu's bug thing (I assume on other distros too):

https://bugs.launchpad.net/ubuntu/+bug/104535

https://bugs.launchpad.net/ubuntu/+s...ort/+bug/59695

A smartctl showed me my Load_Cycle_Count was through the roof. So I got worried about my drive dying a horrible early death and decided to work around the problem with what seems to be the most often recommended approach:
Code:

sudo hdparm -B 255 /dev/sda
The workaround worked fine - the clicking stopped (I also added the command to the startup sequence, etc). Granted, I can't change the past and whatever damage was done is done. I'm just happy I caught this sooner rather than later (the laptop is still relatively new).
Code:

win32sux@candystore:~$ sudo smartctl -a -d ata /dev/sda
smartctl version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF INFORMATION SECTION ===
Device Model:    Hitachi HTS541680J9SA00
Serial Number:    SBXXXXXXXXXXXXX
Firmware Version: SB2OC74P
User Capacity:    80,026,361,856 bytes
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:  7
ATA Standard is:  ATA/ATAPI-7 T13 1532D revision 1
Local Time is:    Mon Oct  1 22:16:52 2007 EST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x85) Offline data collection activity
                                        was aborted by an interrupting command from host.
                                        Auto Offline Data Collection: Enabled.
Self-test execution status:      (  0) The previous self-test routine completed
                                        without error or no self-test has ever
                                        been run.
Total time to complete Offline
data collection:                ( 645) seconds.
Offline data collection
capabilities:                    (0x5b) SMART execute Offline immediate.
                                        Auto Offline data collection on/off support.
                                        Suspend Offline collection upon new
                                        command.
                                        Offline surface scan supported.
                                        Self-test supported.
                                        No Conveyance Self-test supported.
                                        Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                                        power-saving mode.
                                        Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                                        General Purpose Logging supported.
Short self-test routine
recommended polling time:        (  2) minutes.
Extended self-test routine
recommended polling time:        (  44) minutes.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG    VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate    0x000b  100  100  062    Pre-fail  Always      -      0
  2 Throughput_Performance  0x0004  100  100  000    Old_age  Offline      -      1351
  3 Spin_Up_Time            0x0007  253  253  033    Pre-fail  Always      -      0
  4 Start_Stop_Count        0x0012  100  100  000    Old_age  Always      -      591
  5 Reallocated_Sector_Ct  0x0033  100  100  005    Pre-fail  Always      -      0
  7 Seek_Error_Rate        0x000a  100  100  000    Old_age  Always      -      0
  8 Seek_Time_Performance  0x0004  100  100  000    Old_age  Offline      -      0
  9 Power_On_Hours          0x0012  099  099  000    Old_age  Always      -      704
 10 Spin_Retry_Count        0x0012  100  100  000    Old_age  Always      -      0
 12 Power_Cycle_Count      0x0032  100  100  000    Old_age  Always      -      591
191 G-Sense_Error_Rate      0x000a  100  100  000    Old_age  Always      -      65536
192 Power-Off_Retract_Count 0x0032  099  099  000    Old_age  Always      -      259
193 Load_Cycle_Count        0x0012  093  093  000    Old_age  Always      -      79353
194 Temperature_Celsius    0x0002  144  144  000    Old_age  Always      -      38 (Lifetime Min/Max 22/48)
196 Reallocated_Event_Count 0x0032  100  100  000    Old_age  Always      -      1
197 Current_Pending_Sector  0x0022  100  100  000    Old_age  Always      -      0
198 Offline_Uncorrectable  0x0008  100  100  000    Old_age  Offline      -      0
199 UDMA_CRC_Error_Count    0x000a  200  253  000    Old_age  Always      -      0
223 Load_Retry_Count        0x000a  100  100  000    Old_age  Always      -      0
225 Load_Cycle_Count        0x0012  093  093  000    Old_age  Always      -      79353

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline      Completed without error      00%        1        -
# 2  Short offline      Completed without error      00%        0        -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

So here's my questions: From what I've read, the clicking problem is due to excessive amounts of "disk head parking" going on. From what I understand, disk head parking is a safety measure which prevents damage to the drive when it's dropped, etc. For some reason, however, there is insane amounts of it happening out-of-the-box on some GNU/Linux setups. So what does this have to do with the disk's APM? From "man hdparm":
Code:

      -B    Set Advanced Power Management feature, if the drive supports it. A low value means aggressive power management and a high value means  bet‐
              ter performance. A value of 255 will disable apm on the drive.

Does this mean my drive was spinning down every few seconds? Or is the parking a separate thing which doesn't require spinning down? I actually thought that by not enabling "laptop mode" I wouldn't have any spin downs.
Code:

win32sux@candystore:~$ cat /proc/sys/vm/laptop_mode
0

I know that the 255 disables the APM feature, but I would like to know where can I find documentation about the other 254 possible settings? The man page's "aggressive" description doesn't say much. For example, if I would set 254, how exactly does that affect the drive? Is there a time calculation that needs to be done, as with other settings? I've tried googling for ATA power management specifications but didn't have any luck. Basically, I'm worried that by completely disabling this APM I have increased the risk of my disk being damaged if my laptop is dropped or something like that. Any light you can shed on this would be - as always - greatly appreciated.

Peacedog 10-02-2007 01:51 PM

Hi win32sux, I've spent a good portion of the morning trying to find some useful info on this topic. Alas, all I have come up with are more man pages and change logs all stating the same information just in different locations.

If it were me, I'd email the Author/developer/maitainer. I have read several articles today that mentioned he explained some of the hdparm switches via email. The address is available on the freshmeat and source forge project pages, and I wouldn't think he would mind explaining a switch with such a brief description. Sorry to be no more help.
Good luck. ;-)

win32sux 10-02-2007 09:36 PM

Thanks for your support, Peacedog! :)

Yeah, emailing the developer is definitely something I would consider in the near future. For now, though, I'd like to wait and see what happens on this thread. BTW, if this clicking issue does indeed eat away at hard disks' life, it's IMHO appalling that it hasn't been addressed by the Ubuntu Laptop Team (the issue is over a year old). I would have at least expected an explanatory statement from them in those bug report pages, considering how potentially serious this is. That said, I wonder if other distros might have addressed this already - I'll have to look into that because if they did then they might have provided an explanation. Anyhow, I look forward to any more feedback anyone might have. If I find anything myself I'll make sure to post it.

JZL240I-U 10-12-2007 03:26 AM

As far as I know APM was superseded by ACPI (google for both?). If so, you can disable APM without negative consequences as long as ACPI is working. Now that has sometimes issues with laptops, so you should look into it on your machine...

win32sux 10-30-2007 01:47 PM

FYI: The issue has now found it's way to Slashdot. Hopefully this increase in attention translates into action on behalf of the Ubuntu folks. At this time, the issue's "importance" has not been elevated - it's still "wishlist".

J.W. 10-30-2007 10:59 PM

Moved: This thread is more suitable in Ubuntu and has been moved accordingly to help your thread/question get the exposure it deserves.

Mod Note: As suggested, this appears to be a Ubuntu-centric issue, and so I'm moving it to that subforum

win32sux 01-15-2009 06:22 AM

Seems like a proper fix for this has finally found it's way to intrepid-updates. At least that's what I can gather after monitoring the discussion on the mailing list about this bug. I quote from the changelog:
Quote:

acpi-support (0.114-0intrepid1) intrepid-proposed; urgency=low

* {ac,battery,resume,start}.d/90-hdparm.sh: don't just check whether
laptop-mode is configured to control the drives, also check whether
laptop-mode itself is *enabled*. Finally closes LP: #59695.

-- Steve Langasek <steve.langasek@ubuntu.com> Mon, 05 Jan 2009 10:50:10 +0000
I believe the date on that is when it made it to intrepid-proposed, as AFAICT it's only been available via intrepid-updates for a day or two. Hopefully this means people won't need to manually work around this bug any more. The discussion on the mailing list seems to indicate that this fix still needs some more work, though. So I would expect there will either be further updates to this package done, or perhaps Ubuntu 9.04 will include the more complete fix. In any case, this is really good news for a lot of users!


EDIT: Indeed, soon after posting this another update was released:
Quote:

acpi-support (0.114-0intrepid2) intrepid-proposed; urgency=low

[ Jakob Unterwurzacher ]
* Defensive quoting in 90-hdparm.sh, so that the script doesn't throw
a syntax error when the battery state is undetermined.

[ Steve Langasek ]
* lib/power-funcs: refactor getState() to return 'AC' by default,
since this is implicitly the case if we don't have a battery.
LP: #59695.

-- Steve Langasek <steve.langasek@ubuntu.com> Thu, 15 Jan 2009 13:37:16 +0000


All times are GMT -5. The time now is 07:48 PM.