Linux File System – Part 2

Let’s continue where I left my previous post on Linux file system, with information on different file systems commonly present in most distributions and small comparison between them.

ext2:

ext2 (or second extended file system) is the oldest file system for Linux still in use, and until recently one of the most famous. It was created to overcome the limitations of original ext file system (first file system for Linux).

ext2 is not a journaling file system and is not used by desktop users these days, but it’s still one of the most compatible and tested file system for Linux present.

ext3:

ext3 is the successor of ext2 and allows in-place upgrade from ext2. Main difference between the two is addition of journaling in ext3. As ext3 is basically just ext2 with some additional features, it can also be mounted as ext2, though doing so removes the advantage of ext3 file system. In other words, ext3 is backward-compatible. It also provides great compatibility with other operating systems, like windows, that is, you can mount ext3 (and ext2) partitions in Windows using utility.

ext3 provides three different level of journaling:

  • Journal
  • Ordered
  • Writeback

With “journal” offering maximum journaling (both meta-data and user-data), and “writeback” offering minimal journaling (only meta-data). Default journaling level is “ordered”, which is meta-data only journaling but which makes sure that data is written to disk before committing to journal (a precaution not taken in “writeback”), which save from data-corruption.

ReiserFS:

ResiserFS is also a journaled file system, but unlike ext3 it provides only meta-data journaling. It was introduced before ext3 and is the first journaling file system for Linux, though ext3, JFS and XFS very soon followed.

Even though ReiserFS is much faster than ext3, it is sometimes not preferred over other file systems. One of that reason was given by SUSE, when they changed their default file system from ReiserFS to ext3. According to them, ReiserFS doesn’t scale very well on multiple core systems as the critical sections are executed on only one core at a time.

Work on it’s successor Reiser4 is going on, and it has been announced that no new features will be added in ReiserFS. And as Reiser4 won’t feature in-place upgrade from ReiserFS (meaning all data will be lost on partition when upgrading), it has also turned down some ReiserFS users.

XFS:

XFS is another journaling file system and like ReiserFS, it only supports meta-data journaling. It is one of the oldest journaling file system for UNIX, which was later ported to Linux.

On average XFS’ performance is not much different from ReiserFS, though where ReiserFS’ provides great speed when dealing with smaller files, XFS is much better with large files.

Like all other file systems, XFS has it’s own disadvantages too, deleting files is slower than other file systems, and creating/deleting directories also takes more time. XFS also has no un-delete utility, which makes it almost impossible to recover any data once it is deleted (there appears to be one way to do it, if you are desperate enough). Also XFS file system can not be shrunk (it’s size can be increased though).

There is no utility to mount XFS file system under windows. There used to be crossmeta drivers that allowed read/write support in windows, but it isn’t available anymore, even when it was available, it was supposed to be quite buggy.

JFS:

JFS (Journaling File System) is one of the lesser known file system. Like XFS it has been around quite some and then later ported to linux. It offers meta-data journaling, similar to that of XFS and ext3′s “writeback”.

I haven’t tried JFS yet, but according to reviews and others I have checked with, it provides good speed and reliability. Also, it works efficiently even under high load, and doesn’t use too much CPU in these cases, which makes it preferred file system in cases when CPU efficiency is required, though it is not as widely supported by Linux distributions as the other file systems mentioned here.

I couldn’t find any utility or information to mount JFS under windows, most probably there isn’t one.

Conclusion:

All file systems have different advantages and disadvantages and is useful in particular scenario. ext2 is best to use when installing Linux on flash disk. ext3 provides better data recovery option than other file systems so, it’s preferred to use it for /boot or / (root). Either ext3 or ReiserFS can be used to share partition with windows installtion on same computer. XFS is good to use for large parition which contains large files, like movie collection, backup data etc. Whereas JFS can be used pretty much anywhere, preferablly on partition which contains both large and small files and when that system doesn’t dual-boot with windows.

Linux File Systems

File system is a system to store and access the files (and directories) on any computer. Usually users don’t have to worry about which file system they are using, operating systems take care of it all. Though knowing their strength and weaknesses can sometimes help one to choose better option depending on the scenario.

There are many file systems present, suitable for different needs and can be categorized in many different categories, though we aren’t going to discuss them all here (if you are interested, you can check the list of all file system). In most Linux distributions, there is option to choose from two to five different file systems, which can be classified in two general categories:

  • Journaled (or journaling) File System
  • Non-journaled File System

Journaling File System:

Journaling file systems makes a log (or journal) of all the changes made before they are written to disk. This is helpful when system crash or power failure may cause loss of some data, while the changes are still being written to disk. In such case, system compares the disk state with journal, and update the disk where required, resulting in data recovery.

Every file has two parts, data and meta data. Data (or user data) is everything present in the file, that is, in case of text file it will be all the text present in file, for music file, it will be the music etc. whereas, meta data is data about data, like when was file last accessed, modified or created. Title of the song and artist information for music file and author information stored by some office programs is also meta-data.

This brings us to a sub-category of journaled file system.

  • Meta-data Journaling

As the name implies, meta data journaling file systems only log the meta data of the file and not the user data. It provides better performance then complete journaling file system, but doesn’t provide full data recovery options.

Non-journaled File System:

Non-journaled file system are those which doesn’t provide journaling. Which means in case of system crash or power failure, there are chances of data getting corrupt. It also means data is written just once (as it doesn’t have to written to the journal) there are fewer read/write operations on disk compared to journaled file system, which makes it preferable to use on flash drives and other solid-state drives, which can increase their life span.

That’s all for now, in next post I will provide comparison of different file systems for linux.