Linux: mount options to improve performance on slow HDDs?

8,395

Solution 1

What do you need the drive to do? Performance often varies by file system type & what task is being performed.

Setting noatime on your partition or changing to a reiserfs might give some small performance boost, but you might create NFS problems for yourself. If the local ext4 disk is slower than an NFS mount, I think something else is going on. I think you need to see what else is going on in your system that is keeping your disk from getting around to your write tasks. Consider looking at what is doing all this writing. Lets say something is pounding /tmp. Moving /tmp to it's own partition would help with the rest of your local partitions.

You may be suffering from a need to defrag your drive. Although linux filesystems don't suffer from fragmentation as dramatically as NTFS, they do fragment over time. Since ext4 defrag is not too straightforward (kernel mode required), you might just reformat since you seemed willing to try a new file system type.

Mount settings to try:

  1. noatime & nodiratime
    • no acl
    • data=writeback,nobh
    • delalloc - which should already be the default - no need to set.
    • commit=N The default is 5 seconds, good for safety, 'bad' for performance. Setting it to higher values might cause you to lose 'N' seconds of work if your machine crashes. Journaling still preserved, so the disk is unaffected.
    • inode_readahead=n
    • max_batch_time=N

Solution 2

I use noatime to decrease the overall write-access time.

Share:
8,395

Related videos on Youtube

John Dunne
Author by

John Dunne

Updated on September 17, 2022

Comments

  • John Dunne
    John Dunne almost 2 years

    I encounter a performance problem with two HDDs. One is fast but mounted remotely through NFS, the other is local (ext4) but slow.

    No, exchanging the two drives is not an option, because it would make the installation on the other system suffer from it.

    I have the subjective impression that most of the performance loss is happening during the writing of cached data (in both cases: local and remote).
    An other empirical evidence is that sync takes always less that a second, even after lots of writing. Again, for me it means: the write cache is too small, or is used too little, or similar.

    The question is: can I improve performance with some mount options?

    I have found in mount's man page some option which might have to do with performance: max_batch_time, delalloc. But I can't guess what's the default, what they do, ...

    Additional question: Is there a chance of improving performance by reformatting an ext4 partition with different options?

    • Broam
      Broam over 14 years
      Do you have the ext4 drive formatted with extents support?
    • John Dunne
      John Dunne over 14 years
      I have formatted it with Opensuse's default options from Yast. I'm very sure it's enabled.
    • ElPoney
      ElPoney over 14 years
      How slow is slow? If you don't measure, you can't know if you are already very close at the hw highest performance (if so, your only option is to buy new hw - otherwise you can spend time trying to optimize your settings)
  • John Dunne
    John Dunne over 14 years
    Yes, I'm already using noatime and nodiratime and data=writeback.
  • Junaid
    Junaid about 10 years
    "noatime" also has the same effect of "nodiratime", no need to use both parameters. lwn.net/Articles/245002