2008年5月12日 星期一

HOWTO: Tweak your ext3 filesystem for a performance boost

from http://ubuntuforums.org/showthread.php?t=107856

for ext3 and ReiserFS

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.

Ext3 & ReiserFS has three kinds of journaling methods:
  1. Journal Data Writeback
  2. Journal Data Ordered
  3. Journal Data
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.
price: old data might appear in files after a crash and journal recovery. The last things you wrote or did prior a crash isn't recovered.


Make ext3 or reiserfs use journal data writeback
Edit /etc/fstab, Add the following line
/dev/hda1 / ext3 defaults,errors=remount-ro,atime,auto,rw,dev,exec,suid,nouser,data=writeback 0 1
Edit /boot/grub/menu.lst, and add the bold part
# defoptions=quiet splash rootflags=data=writeback
# altoptions=(recovery mode) single rootflags=data=writeback
sudo update-grub



(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



Remove update of access time for files
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.

Edit /etc/fstab, add the following marked in bold
/dev/hda1 / ext3 defaults,errors=remount-ro,noatime,auto,rw,dev,exec,suid,nouser,data=writeback 0 1

沒有留言: