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
Code:
sudo kate /etc/fstab
Add the thing marked in bold to your fstab root mount line.
Code:
/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
Code:
sudo kate /boot/grub/menu.lst
Change the following two lines by adding the following marked in bold
Code:
# defoptions=quiet splash rootflags=data=writeback
# altoptions=(recovery mode) single rootflags=data=writeback
Now run 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.
Code:
sudo tune2fs -o journal_data_writeback /dev/hda1
Check that it is running
Code:
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:
Code:
sudo kate /etc/fstab
add the following marked in bold(not that you might have the switch that enables it)
Code:
/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:D
Re: HOWTO: Tweal your ext3 filesystem for a performance boost
Cool howto, but I use reiserfs.
I wonder if there is anyway to speed up reiserfs?
Re: HOWTO: Tweal your ext3 filesystem for a performance boost
You can apply the noatime option to your reiserfs partitions in fstab.
Re: HOWTO: Tweal your ext3 filesystem for a performance boost
Well...I didn't want to mention to much about reiserfs since I haven't tried anything on it yet. I'll install it in about 2 weeks. But according to the documentation of reiserfs kernel 2.6.X the above howto should work and make it faster as well.
Not that I have not tried it but I would be happy to see someone try it before me:D and report back here. Then I'll change the howto so that it includes both popular filesystems.
Re: HOWTO: Tweal your ext3 filesystem for a performance boost
Looks cool. Ill use this on non-system (storage) drives. :)
Re: HOWTO: Tweal your ext3 filesystem for a performance boost
Quote:
Looks cool. Ill use this on non-system (storage) drives.
Enjoy the ride!:cool:
Re: HOWTO: Tweal your ext3 filesystem for a performance boost
Quote:
Originally Posted by reet
You can apply the noatime option to your reiserfs partitions in fstab.
Looked it up, yeah shouldn't cause any trouble and perhaps increase
performance.
Re: HOWTO: Tweal your ext3 filesystem for a performance boost
Thanks a lot, GoldBuggie...amazing difference on my system!
Happy New Year.
Re: HOWTO: Tweal your ext3 filesystem for a performance boost
Whoa, I knew I had damn small linux on a usb-stick for a reason. ;)
System no more booted and gave errors "read only filesystem". Got it back running by undoing the changes but I couldn't find any typos or anything in either fstab or in menu.lst. Unless the fstab line for the filesystem needs more options than these?
Quote:
/dev/hda3 / ext3 defaults,errors=remount-ro,noatime,data=writeback 0 1
Re: HOWTO: Tweal your ext3 filesystem for a performance boost
I had the same problem.
Another way to rescue is to reboot into recovery mode, when it gets you to the CLI type:
mount -o remount,rw /dev/hdXX /
hdXX being your hard drive partition. This will allow you to edit the fstab and menu.lst to undo the chnages.
Now if I could just work out what's going wrong, time for bed me thinks...leave it until tomorrow.