Files and Systems

Compiling applications in FC4 is a pain in the ass. All sorts of weird errors cropping up like “GCC version blacklisted”. So I’m thinking of moving to Debian 3.1.

Now I was always confused about linux filesystems. So I thought I might as well do some reading and then write a little article on this. Here goes:

Linux Filesystems:

Installing linux today is a relatively painfree task compared to say, 5 years ago due to improved hardware detection, more intuitive setup programs, installation media checks etc. but there’s still one aspect which confuses beginners: Disk partitioning.

Newer distros usually have some sort of “auto-allocate” option which automatically partitions free space on a hard drive, creating the necessary swap, boot and / partitions. This may be great for beginners but a power user can make his linux box run much faster if he pays careful attention to the filesystem used.

Linux supports many filesystems, the major ones being ext 2/3, ReiserFS, XFS, JFS. Each FS has its own pros and cons and selecting the right one can boost performance. But before digging into the details, let’s clear up some terms:

Journaled Filesystem: A journaling file system is a file system that logs changes to a journal (usually a circular log in a specially-allocated area) before actually writing them to the main file system. In this manner, in the event of a system crash, the journal can be checked for the most recently modified metadata, thus ensuring a rapid recovery of the filesystem. This capability is especially important on large systems. Without this feature, a filesystem such as ext2 would require the fsck facility to run on reboot after a hardware failure. For large filesystems, this process can take hours.

Metadata-only Journaling: Journaling can have a severe impact on performance because it requires that all data be written twice. Metadata-only journaling is a compromise between reliability and performance that stores only changes to file metadata (which is usually relatively small and hence less of a drain on performance) in the journal.

Out of the above mentioned filesystems, ext2 doesn’t support journaling. All others do. Now for some info on the FS themselves:

ext2: The traditional linux FS. No metadata journaling. NOT recommended.

ext3: The journaled version of ext2. Provides metadata journaling for fast recovery in addition to other enhanced journaling modes like full data and ordered data journaling. ext3 is a really good and reliable filesystem. Not the fastest though.

ReiserFS: ReiserFS is a B*-tree based filesystem that has very good overall performance and greatly outperforms both ext2 and ext3 when dealing with small files (files less than 4k), often by a factor of 10x-15x. Not rock stable as ext 3 according to some experts.

XFS: XFS is a filesystem with metadata journaling which comes with a robust feature-set and is optimized for scalability. Extremely fast. It is not the least CPU demanding FS but its use of system resources is quite acceptable for older generation hardware. But it has one major disadvantage: Its speed comes from the fact that it caches a lot of data in RAM. So, in case of a power failure, extensive data loss may occur. So use this FS only if you have a UPS.

JFS: JFS is IBM’s high-performance journaling filesystem. Uses very less resources but not better than other filesystems as such.

Now that you have an idea about the various filesystems, we can go ahead with the partitioning.

Layout 1: General system. UPS available:

swap: Linux swap
/boot: ext3
/ (root): XFS

Layout 2: General system. Unreliable power supply:

swap: Linux swap
/boot: ext3
/ (root): ext3

Layout 3: Lots of small files, eg text files:

swap: Linux swap
/boot: ext3
/ (root): ReiserFS

Well, that’s all I know. For more info, search google for “linux filesystems”. Happy formatting 🙂

Advertisements

2 thoughts on “Files and Systems

  1. Remember that step in linux installations.. having a lot of fancy coloured boxes representing ur Hard drive? Well, those boxes are the partitions and well.. uh the colours represent the FS used.

    I wrote this article to help new users select an ideal FS combination for their linux systems.. so that their distros run at full power.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s