Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to calm a "noisey" hard drive
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
extraketchup
n00b
n00b


Joined: 21 Jun 2004
Posts: 29
Location: Maine

PostPosted: Sun Jul 01, 2007 3:10 pm    Post subject: How to calm a "noisey" hard drive Reply with quote

Howdy folks,

I've been on a personal quest for a while now to quiet down my noisy hard drive on my laptop. I've detailed this process on my blog at http://extra-ketchup.blogspot.com/2007/06/quest-for-quiet-hard-drive.html . My goal was to reduce the almost constant "chatter" and "chirping" from what seemed excessive drive head movement even during simple things like surfing the web. While power consumption is part of my concern, my main worry is drive life, as my previous laptop (which also had Gentoo and ran mostly using KDE as my environment) died due to hard drive failure.

Check my blog for details and insights, but here's the quick summary of what I did to quiet down my hard drive so that it very rarely spins up for normal use such as browsing the web:

  • II copied my /usr directory to a fast SD card (my Dell laptop has a built-in card reader) and mounted it read only.
  • I changed various file system settings to reduce writes back to the hard drive - noatime, nodiratime, and commit=3600 as part of my fstab options (I'm currently using ext3, though these options should work on other filesystems)
  • In similar fashion, I adjusted various /proc/sys/vm settings to reducing writes due to dirty pages. NOTE - I actually found that laptop mode made my drive MORE noisy, not less! I think this is because of the demand of KDE on the filesystem, but I turned off laptop mode and my drive is silent now.
  • I set up my init scripts (which are my own to begin with) to copy busy subdirectories of ~/ to my /tmp directory (which is mounted tmpfs) and then mount --bind those directories back to my home directory. This means that while I am browsing, any cache hits or updates, cookies, favicons, history, etc. is saved to a tmpfs (which is in RAM) which is fast and requires no hard drive spinup. KDE is constantly updating it's .kde directory, for example - even moving a window causes an update of the coordinates to be written to a config file! When I shut down, all the updates are copied from RAM (tmpfs) back to the hard drive.

Well, that's basically it. Visit the link about for the details of why this works and some of the caveats of using this system. Overall, not only is my hard drive quiet, but my system is faster and uses less power! I also have the peace of mind that my drive should last longer.

- Mike
_________________
There are more things in heaven and earth, Horatio, Than are dreamt of in your philosophy.
Back to top
View user's profile Send private message
xalan
Apprentice
Apprentice


Joined: 01 Feb 2005
Posts: 190

PostPosted: Sun Jul 01, 2007 4:14 pm    Post subject: Reply with quote

Hey Mike,

Thanks for sharing your experiences. I am going through your blog and learnt some new things.

-x
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Sun Jul 01, 2007 4:31 pm    Post subject: Reply with quote

Also try:
Code:
 -M     Get/set Automatic Acoustic Management (AAM) setting.

From man hdparm
Back to top
View user's profile Send private message
xalan
Apprentice
Apprentice


Joined: 01 Feb 2005
Posts: 190

PostPosted: Sun Jul 01, 2007 5:10 pm    Post subject: Reply with quote

Mike:

Which KDE process generated lots of disk activity. On my box most of disk activity was by pdflush and filesystem journalling daemon kjournald.

-x
Back to top
View user's profile Send private message
extraketchup
n00b
n00b


Joined: 21 Jun 2004
Posts: 29
Location: Maine

PostPosted: Sun Jul 01, 2007 5:22 pm    Post subject: KDE and hard drive activity Reply with quote

xalan wrote:
Mike:

Which KDE process generated lots of disk activity. On my box most of disk activity was by pdflush and filesystem journalling daemon kjournald.

-x


What I noticed is that every time I opened a menu that I hadn't opened before (and thus not in the system cache), the drive was accessed. From what I can tell, KDE waits until you go to a menu or other setting before loading the icons, fonts, etc. that it needs. So just walking down the menus will stir up the drive a bit. It's not brutal thrashing, but if I do want my drive to spin down for a while, it's an issue.

Also, web browsing generates plenty of drive read/writes since history, cache, favicons, and cookies are all recorded each time a new web page is visited. I can spend serious time surfing the web, during which I'd like the hard drive to be able to rest. That's why I copy .kde (and .mozilla for Firefox) to my tmpfs /tmp directory in RAM.

Even moving or resizing a window causes a drive write because KDE records the locations and sizes of windows of various apps so that when you close then reopen that app, it appears where it was last. I'm pretty sure this feature can be turned off in the control center, but I actually like the feature. I prefer to store all this info in my tmpfs RAM (since I may move windows quite a bit depending on what I'm doing), and then copy the final state of things when I shut down the computer back to the hard drive. If my system crashes, I only lose little changes like recent cookies and window positions since .kde is COPIED to /tmp (and back again) for each session.

So, I'd say the two things that make KDE play very nice with the hard drive is the /usr directory on Flash RAM, since KDE consists of many small files (icons, libraries, fonts, etc.) that are randomly accessed throughout using various apps, and also copying my .kde directory (which holds my personal config files, cookies, etc.) to /tmp. I also make sure that kdecache-me is a real directory, not a symlink to /var/tmp.

- Mike
_________________
There are more things in heaven and earth, Horatio, Than are dreamt of in your philosophy.
Back to top
View user's profile Send private message
extraketchup
n00b
n00b


Joined: 21 Jun 2004
Posts: 29
Location: Maine

PostPosted: Sun Jul 01, 2007 6:12 pm    Post subject: Re: Hi Reply with quote

veerakumar wrote:
Your Hard Drive is failing.
Use smart daemon to see it.
Or use diagnostic programs which come or on the website of HDD manufacturers.


No, no - this is a brand new (Dell Linux) laptop. When I say "noisy", I purposefully quote that because I'm not talking about a dying drive, just one that is being forced to do many random seeks across the drive platter. HOWEVER, my OLD laptop failed, and the "chirping" that's regular for hard drives got louder and eventually turned to clunking and odd clicking. It started to stick, and I'd have to "burp" my laptop with a couple hard slaps on the bottom to lose the drive head. Hence my new Dell laptop.

Now I don't know if the busy-ness of that old drive had anything to do with it's eventual failure, but surely reducing the head seeks of my new drive can't hurt! Especially if it reduces power and also enhances performance (win-win-win).

As for SMART, it never said anything was wrong with my old drive, even when the head was stuck! Steve Gibson has lots to say about SMART, and what he says isn't very good..
_________________
There are more things in heaven and earth, Horatio, Than are dreamt of in your philosophy.
Back to top
View user's profile Send private message
xalan
Apprentice
Apprentice


Joined: 01 Feb 2005
Posts: 190

PostPosted: Sun Jul 01, 2007 7:44 pm    Post subject: Re: KDE and hard drive activity Reply with quote

extraketchup wrote:


So, I'd say the two things that make KDE play very nice with the hard drive is the /usr directory on Flash RAM, since KDE consists of many small files (icons, libraries, fonts, etc.) that are randomly accessed throughout using various apps, and also copying my .kde directory (which holds my personal config files, cookies, etc.) to /tmp. I also make sure that kdecache-me is a real directory, not a symlink to /var/tmp.

- Mike


I agree with you regarding firefox issues lots of disk writes. But I have an issue with respect to mounting /usr on "Flash RAM". AFAIK flash memory has a finite write capability on the order of 1 million writes. I don't know if there is a similar limitation for reads. If there is then you will be reducing the life of your flash card very fast since /usr/lib is read very heavily but written rarely. If there is no limitation on reads then you are fine.
Back to top
View user's profile Send private message
micr0c0sm
Tux's lil' helper
Tux's lil' helper


Joined: 29 Oct 2005
Posts: 148
Location: New York

PostPosted: Wed Jul 04, 2007 7:11 am    Post subject: Reply with quote

mind sharing your startup script for your busy ~/ directories and your fstab ? Good tips so far.
Back to top
View user's profile Send private message
extraketchup
n00b
n00b


Joined: 21 Jun 2004
Posts: 29
Location: Maine

PostPosted: Wed Jul 04, 2007 11:04 am    Post subject: "show us the code" Reply with quote

micr0c0sm wrote:
mind sharing your startup script for your busy ~/ directories and your fstab ? Good tips so far.


interesting stuff from fstab (the tabbing doesn't copy over whell):
Code:
/dev/sda1               /               ext3    noatime,async,noatime,nodiratime                1 0
/dev/sda3               none            swap            sw                      0 0
/dev/sda2               /var            ext3    noatime,async,noatime,nodiratime,data=writeback,commit=3600             0 0
/dev/sda4               /home           ext3    noatime,async,noatime,nodiratime,data=journal,commit=3600    0 0
/dev/mmcblk0p1          /usr    ext2    ro,auto,async   0  0


interesting stuff from lilo.conf (for / options):
Code:
image=/boot/vmlinuz
        label=Linux
        read-only
        root=/dev/sda1
        append="rootflags=data=journal,commit=3600"


interesting stuff from my bootscript:
Code:
# The following is to keep the drive quiet but quick
        # TODO - auto set these based on whether on battery or plugged in
        echo 0 > /proc/sys/vm/laptop_mode
        echo 60 > /proc/sys/vm/dirty_background_ratio
        echo 40 > /proc/sys/vm/dirty_ratio
        echo 50000 > /proc/sys/vm/dirty_expire_centisecs
        echo 50000 > /proc/sys/vm/dirty_writeback_centisecs
        echo 10 > /proc/sys/vm/swappiness
        /usr/sbin/acpid
        /sbin/hdparm hdparm -B 255 /dev/sda
        # use SD card "SURRaBoost"
        mount /usr
        # copy busy config directories to tmpfs and mount back
        cp -a /home/mjsurran/.kde3.5 /tmp
        cp -a /home/mjsurran/.mozilla /tmp
        touch /tmp/.xsession-errors
        mount --bind /tmp/.kde3.5 /home/mjsurran/.kde3.5
        mount --bind /tmp/.mozilla /home/mjsurran/.mozilla


note - I'm the only one who uses my laptop. If multiple people use a computer, then the tmpfs code could be modified and placed in the startkde script.
2nd note -
Code:
/sbin/hdparm hdparm -B 255 /dev/sda
quiets down my drive in that the heads don't go back to "rest" every second. It also improved performance quite a bit. My bios must set my hard drive to a very aggressive self-powersavings mode. I'm working on ACPI scripts to set the drive back to that powersavings mode when on battery.
_________________
There are more things in heaven and earth, Horatio, Than are dreamt of in your philosophy.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum