Results 1 to 10 of 172

Thread: HOWTO: Tweak your ext3 filesystem for a performance boost

Threaded View

  1. #1
    Join Date
    Apr 2005
    Stockholm, Sweden
    Kubuntu 7.10 Gutsy Gibbon

    HOWTO: Tweak your ext3 filesystem for a performance boost

    I'm using an old 900MHz Toshiba Laptop and these below changes changed my system quite noticable. You should feel an increase in video, image or audio usage.

    Linux has several choices of filesystems. Two quite known filesystems are ext3 and ReiserFS. This following howto works for both those two filesystems.

    The ext3 filesystem provides more journaling which makes it "safer" and recovery of files in case of a crash is more likely. This has its price in performance thou. ReiserFS is a faster filesystem but with less safety. The default for ubuntu systems is ext3.

    Ext3 & ReiserFS has three kinds of journaling methods:
    1) Journal Data Writeback
    2) Journal Data Ordered
    3) Journal Data

    I don't want to explain them to much here but the difference of the three is when the actual data is written to the filesystem in relation to the metadata and its entrance into the journal.

    By default the the 2nd method is used.

    To speed things up we will make it use method 1. The price to pay is that it may allow old data to appear in files after a crash and journal recovery. That is the last things you wrote or did prior a crash isn't recovered. (I can live with that, since I the most recent things I often have in my head and can reproduce)

    How to make ext3 or reiserfs use journal data writeback

    sudo kate /etc/fstab
    Add the thing marked in bold to your fstab root mount line.
    /dev/hda1 / ext3 defaults,errors=remount-ro,atime,auto,rw,dev,exec,suid,nouser,data=writeback 0 1
    Save that file and change the following file
    sudo kate /boot/grub/menu.lst
    Change the following two lines by adding the following marked in bold
    # defoptions=quiet splash rootflags=data=writeback
    # altoptions=(recovery mode) single rootflags=data=writeback
    Now run
    sudo update-grub
    and the added flags will automatically be added to the kernel line and stay there in case of kernel update(thank you reet for this method)

    (There have been reports of problems when rebooting if the following is not done) Note! tune2fs only works for ext3. Reiserfs can't change the journal method on the fly.
    Before rebooting change the filesystem manually to writeback.
     sudo tune2fs -o journal_data_writeback /dev/hda1
    Check that it is running
     sudo tune2fs -l /dev/hda1
    That's it. However I have one more thing I would recommend changing.

    Remove update of access time for files

    Having the modified time change I can understand but having the system updating the access time every time a file is accessed is not to my liking. According to the manual the only thing that might happen if you turn this off is that when compiling certain things the make might need that info. (I haven't seen a compilation that needs it yet and if I somehow come across it I will change this back or look into that then, but it is such a rare case)

    To change this do the following:
     sudo kate /etc/fstab
    add the following marked in bold(not that you might have the switch that enables it)
    /dev/hda1 / ext3 defaults,errors=remount-ro,noatime,auto,rw,dev,exec,suid,nouser,data=writeback 0 1
    Now reboot and enjoy a much faster system
    Last edited by GoldBuggie; August 9th, 2006 at 08:34 AM.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts