Speeding Up Ext3 Filesystems

There are a few things you can do to speed up the ext3 filesystem, and when combined they make a lot of difference!

Firstly, you probably don’t need to store the “last accessed” time of every file and/or every directory, so add “noatime,nodiratime” to the mount options in /etc/fstab (add a comma then that text straight after the word “defaults” in the relevant line of /etc/fstab).

Furthermore, you can optimise the caching of data in the filesystem by adding “data=writeback” to the mount options in /etc/fstab. This is pretty safe as long as your system isn’t very busy and liable to lose power without warning. The only downside is that should it lose power while writing to the disk, a few files may end up with slightly old content in them.

The last one is a little more complicated, but well worth doing. You can change the directories to be B-trees instead of lists, which are a lot faster if you have many files in each directory. Say your filesystem is mounted off /dev/sdb1, for example.
  1. Unmount the filesystem, having stopped all processes that are using it, with “umount /dev/sdb1”.
  2. Change the directory indexing with “tune2fs -O dir_index /dev/sdb1”.
  3. Re-build all the existing directories with “e2fsck -D /dev/sdb1”.
  4. Reboot, or else remount the filesystem and start the processes back up. Rebooting is simpler Happy
  5. That should make your filesystem run a whole lot faster!
Comments