Filesystem tuning
How much time a system uses IO (In/Out) disc tasks has a signifficant impact on the overall system performance. What filesystem a disc uses, and how it is tuned, can dramatically influence how much time a system uses waiting for data to be written to, or read from, the disc.
What filesystem should I choose?[edit]
IBM wiki story regarding filesystems is this:[1]
# xfs has edge on very large files # jfs is better on smaller files
However, views regarding what filesystems is subject to many long debates.
- xfs is very efficient for storing mainly very large files. xfs may be a good choice for a 200 GB drive dedicated to storing your XviD collection (mainly 350MB and 700 MB files).
- reiserfs is said to be excellent for drives who store both large and small files, and it is claimed by many to be the best choice for harddrives who mainly store small files.
- jfs is also very efficient for drives who mostly store small files. IBM story does seem to check out.
- ext3 does not seem to be recommended by anyone for it's performance. However, it is said to be "stable" and "not subject to data loss". These properties are in many cases far more important than performance.
Chaning filesystem may be a good idea if you can, but it is rarely an option when your drives are all close to full.
Do you need to record access times?[edit]
GNU/Linux records the access times, called atime, when files are written. This can be a good thing, it allows you to search for files last accessed in a given interval, sort files according to access times, and so on.
But do you really need this information? Recording atimes does cause a signifficant amount of system load on most files systems. Turning it off gives a performance gain on most filesystems, including ext2, ext3 and reiserfs.
What you need to do to turn it off is to add noatime to you /etc/fstab file.
/dev/hda5 /home reiserfs noatime,notail,rw,user,exec,auto 1 1 /dev/hda7 /pub reiserfs noatime,rw,exec,auto 1 1
It must be mentioned that you do not need to reboot to turn off atimes. All you have to do is to change your fstab and remount your filesystem with the mount option (-o) remount:
# mount -oremount /home
You can view how your filesystems are mounted by simply typing mount, or by looking at the file /etc/mtab.
Block sizes[edit]
A large block size may give significant performance gains on filesystems who mainly store very large files.
The default block size is 1024 bytes. Linux kernel mailing list debates over the last years are filled with arguments that a block size fo 4096 should be the default because it cases less file fragmentation, faster fsck's, faster file delition, and faster reading speed because a larger block size causes fewer seeks.
Changing the block size to increase performance is not an option in most cases because it requires that you reformat the filesystem. However, it is something you may want to consider when installing new drives and systems.
The format command allows you to change the block size with -b size:
mke2fs -b 4096 /dev/hdx
It is relevant to mention that mke2fs will reserve 5% of the filesystem for root. This percentage can be changed with -m, -m 1 will only reserve 1% for root:
mke2fs -b 4096 -m 1 /dev/whatever
5% does not make as much sense on a 200 GB harddrive as it does on a 10 GB harddrive.