How to Increase ext3 and ReiserFS filesystems Performance
The ext3 or third extended filesystem is a journalled file system that is commonly used by the Linux operating system. It is the default file system for many popular Linux distributions
Features of ext3 File System
The ext3 file system is essentially an enhanced version of the ext2 file system. These improvements provide the following advantages
After an unexpected power failure or system crash (also called an unclean system shutdown), each mounted ext2 file system on the machine must be checked for consistency by the e2fsck program. This is a time-consuming process that can delay system boot time significantly, especially with large volumes containing a large number of files. During this time, any data on the volumes is unreachable.
The journaling provided by the ext3 file system means that this sort of file system check is no longer necessary after an unclean system shutdown. The only time a consistency check occurs using ext3 is in certain rare hardware failure cases, such as hard drive failures. The time to recover an ext3 file system after an unclean system shutdown does not depend on the size of the file system or the number of files; rather, it depends on the size of the journal used to maintain consistency. The default journal size takes about a second to recover, depending on the speed of the hardware.
The ext3 file system provides stronger data integrity in the event that an unclean system shutdown occurs. The ext3 file system allows you to choose the type and level of protection that your data receives. By default, Most Linux Distributions configures ext3 volumes to keep a high level of data consistency with regard to the state of the file system.
Despite writing some data more than once, ext3 has a higher throughput in most cases than ext2 because ext3's journaling optimizes hard drive head motion. You can choose from three journaling modes to optimize speed, but doing so means trade offs in regards to data integrity.
It is easy to change from ext2 to ext3 and gain the benefits of a robust journaling file system without reformatting. See the Section called Converting to an ext3 File System for more on how to perform this task.
ReiserFS is a general-purpose, journaled computer file system designed and implemented by a team at Namesys led by Hans Reiser.ReiserFS is currently supported on Linux and may be included in other operating systems in the future. Introduced in version 2.4.1 of the Linux kernel, it was the first journaling file system to be included in the standard kernel.
ReiserFS has fast journaling, which means that you don't spend your life waiting for fsck every time your laptop battery dies, or the UPS for your mission critical server gets its batteries disconnected accidentally by the UPS company's service crew, or your kernel was not as ready for prime time as you hoped, or the silly thing decides you mounted it too many times today.
ReiserFS is based on fast balanced trees. Balanced trees are more robust in their performance, and are a more sophisticated algorithmic foundation for a file system. When we started our project, there was a consensus in the industry that balanced trees were too slow for file system usage patterns. We proved that if you just do them right they are better--take a look at the benchmarks. We have fewer worst case performance scenarios than other file systems and generally better overall performance. If you put 100,000 files in one directory, we think its fine; many other file systems try to tell you that you are wrong to want to do it.
ReiserFS is more space efficient. If you write 100 byte files, we pack many of them into one block. Other file systems put each of them into their own block. We don't have fixed space allocation for inodes. That saves 6% of your disk.
Ext3 & ReiserFS has three kinds of journaling methods
1) Journal Data Writeback
2) Journal Data Ordered
3) Journal Data
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.
How to make ext3 or reiserfs use journal data writeback
First you need to take fstab file using the following command
sudo cp /etc/fstab /etc/fstab.orig
Edit the /etc/fstab file using the following command
sudo vi /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 exit
You need to take Grubmenu file backup using the following command
sudo cp /boot/grub/menu.lst /boot/grub/menu.lst.orig
Now you need to edit the grub menu list file using the following command
sudo vi /boot/grub/menu.lst
look for the following two lines
# defoptions=quiet splash
# altoptions=(recovery mode) single
# defoptions=quiet splash rootflags=data=writeback
# altoptions=(recovery mode) single rootflags=data=writeback
Save that file and exit
Now you need to update the grub using the following command
the added flags will automatically be added to the kernel line and stay there in case of kernel update
Changes to Ext3 FileSystem Only
Note:- tune2fs only works for ext3. Reiserfs can't change the journal method
Before rebooting change the filesystem manually to writeback using the following command
sudo tune2fs -o journal_data_writeback /dev/hda1
Check that it is running or not using the following command
sudo tune2fs -l /dev/hda1
Remove update of access time for files
Having the modified time change you 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.
To change this do the following
sudo vi /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
Now reboot and enjoy a much faster system