Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old December 24th, 2005   #1
GoldBuggie
Way Too Much Ubuntu
 
GoldBuggie's Avatar
 
Join Date: Apr 2005
Location: Stockholm, Sweden
Beans: 326
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

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
Code:
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.
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

Last edited by GoldBuggie; August 9th, 2006 at 03:34 AM..
GoldBuggie is offline   Reply With Quote
Old December 26th, 2005   #2
viscount
Just Give Me the Beans!
 
viscount's Avatar
 
Join Date: Dec 2005
Beans: 49
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?
__________________
When things are bad, ask yourself what Gandalf would do.
But when things get just right plain weird, then you need to ask: What would Skooby Dooby do?
viscount is offline   Reply With Quote
Old December 27th, 2005   #3
reet
Just Give Me the Beans!
 
Join Date: Sep 2005
Location: Canada
Beans: 75
Xubuntu
Re: HOWTO: Tweal your ext3 filesystem for a performance boost

You can apply the noatime option to your reiserfs partitions in fstab.
reet is offline   Reply With Quote
Old December 27th, 2005   #4
GoldBuggie
Way Too Much Ubuntu
 
GoldBuggie's Avatar
 
Join Date: Apr 2005
Location: Stockholm, Sweden
Beans: 326
Kubuntu 7.10 Gutsy Gibbon
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 and report back here. Then I'll change the howto so that it includes both popular filesystems.
GoldBuggie is offline   Reply With Quote
Old December 27th, 2005   #5
MetalMusicAddict
Tall Cafè Ubuntu
 
MetalMusicAddict's Avatar
 
Join Date: Jan 2005
My beans are hidden!
Re: HOWTO: Tweal your ext3 filesystem for a performance boost

Looks cool. Ill use this on non-system (storage) drives.
MetalMusicAddict is offline   Reply With Quote
Old December 27th, 2005   #6
GoldBuggie
Way Too Much Ubuntu
 
GoldBuggie's Avatar
 
Join Date: Apr 2005
Location: Stockholm, Sweden
Beans: 326
Kubuntu 7.10 Gutsy Gibbon
Re: HOWTO: Tweal your ext3 filesystem for a performance boost

Quote:
Looks cool. Ill use this on non-system (storage) drives.
Enjoy the ride!
GoldBuggie is offline   Reply With Quote
Old December 28th, 2005   #7
viscount
Just Give Me the Beans!
 
viscount's Avatar
 
Join Date: Dec 2005
Beans: 49
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.
__________________
When things are bad, ask yourself what Gandalf would do.
But when things get just right plain weird, then you need to ask: What would Skooby Dooby do?
viscount is offline   Reply With Quote
Old December 28th, 2005   #8
xyz
Chocolate-Covered Ubuntu Beans
 
xyz's Avatar
 
Join Date: Oct 2005
Location: Fribourg,Switzerland
Beans: 2,202
Re: HOWTO: Tweal your ext3 filesystem for a performance boost

Thanks a lot, GoldBuggie...amazing difference on my system!
Happy New Year.
xyz is offline   Reply With Quote
Old December 28th, 2005   #9
kaamos
Fresh Brewed Ubuntu
 
kaamos's Avatar
 
Join Date: Oct 2005
Location: Helsinki, Finland
Beans: 1,350
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

Last edited by kaamos; December 28th, 2005 at 08:09 AM..
kaamos is offline   Reply With Quote
Old December 28th, 2005   #10
bikeboy
Dipped in Ubuntu
 
Join Date: Nov 2004
Location: Melbourne
Beans: 576
Ubuntu 8.04 Hardy Heron
Send a message via MSN to bikeboy
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.
bikeboy is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:42 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry