APM level damage my hard disk (solved)

Questions about hardware, drivers and peripherals
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
eMan

APM level damage my hard disk (solved)

Post by eMan »

Hi there
I have a problem with mint 12 that has reported for ubuntu a long time age
https://bugs.launchpad.net/ubuntu/+sour ... +bug/59695
I think this problem must have fixed but it doesn't in mint 12
after installing smartmontools run this command as root
# smartctl -a /dev/sda | grep Load_Cycle_Count
it showed me 53773 Cycle Count
in 10 minutes I run the same command. the output shock me. It has been increasing so fast.
After many searches I found that this command would help me and disable APM
# hdparm -B 255 /dev/sda
But When I restart the machine everything goes back.
So I wrote a script like this

Code: Select all

#!/bin/sh
hdparm -B 255 /dev/sda
and named it as disable-APM.sh and placed it under /etc/init.d
Edit /etc/init.d/rc.local and add the following line to the end of it

Code: Select all

/etc/init.d/disable-APM.sh
But it was not useful so
I added hdparm -B 255 /dev/sda to the above file but ...
But it didn't affect the system :( and never run the script as root at start up
How can I run this script on system start up as root?
I already run chmod a+x /etc/init.d/disable-APM.sh and it is executable
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
xenopeek
Level 25
Level 25
Posts: 29459
Joined: Wed Jul 06, 2011 3:58 am

Re: APM level damage my hard disk

Post by xenopeek »

With your script already in /etc/init.d/disable-APM.sh, do the following to make it run on boot:

Code: Select all

sudo ln -sf /etc/init.d/disable-APM.sh /etc/rc2.d/S99disable-APM.sh
If it still doesn't work, add some logging to your script so you know what is going on:

Code: Select all

#!/bin/bash

# redirect stdout and stderr to logfile
exec >>/var/log/disable-APM.log 2>&1

# announce started
echo "$(date +'%b %d %X') $(uname -n) $(basename $0): starting"

# disable APM
hdparm -B 255 /dev/sda
Then after boot check the file /var/log/disable-APM.log for any errors.
Image
eMan

Re: APM level damage my hard disk

Post by eMan »

an odd problem :)
Thank you my friend for script. My script doesn't stop increasing cycle count but your script does. I couldn't understand why but it does.
I checked the log file and everything was OK.
When I suspend the note book the APM level goes to normal for fixing it you can copy the script into
/etc/apm/suspend.d/
/etc/apm/resume.d

Thank you very much xenopeek
User avatar
xenopeek
Level 25
Level 25
Posts: 29459
Joined: Wed Jul 06, 2011 3:58 am

Re: APM level damage my hard disk (solved)

Post by xenopeek »

Thanks for sharing the results. Perhaps your script would need the full path to the hdparm binary if run from init (/sbin/hdparm -B 255 /dev/sda). ANyway, you have it fixed now so that doesn't matter so much :wink:
Image
jazz.h
Level 4
Level 4
Posts: 363
Joined: Sat Jun 18, 2011 7:13 am

Re: APM level damage my hard disk (solved)

Post by jazz.h »

eMan, did you use to hear a hdd clicking while this load_cycle_count event was increasing?
I could hear it on my Acer until I didn't stop it (http://askubuntu.com/questions/82803/ha ... acer-ao722).
Really annoying bug, considering the fact that 600.000 is the max number for average hard disk... :(
Locked

Return to “Hardware Support”