1. Comparing a Few File Systems

During installation, you can choose different file systems for your partitions, so they will be formatted using different algorithms.

Unless you are a specialist, choosing a file system is not obvious. We will take a quick look at a few current file systems, all of which are available with Mandrakelinux.

1.1. Different Usable File Systems

1.1.1. Ext2

The Second Extended File System (its abbreviated form is ext2FS or simply ext2) has been GNU/Linux's default file system for many years. It replaced the Extended File System (that's where the “Second” comes from). ext2 corrects certain problems and limitations of its predecessor.

ext2 respects the usual standards for UNIX®-type file systems. Since its inception, it was destined to evolve while still offering great robustness and good performance.

[Note]Note

It needs to be umounted to be resized.

1.1.2. Ext3

As its name suggests, the Third Extended File System is ext2's successor. It is compatible with the latter but enhanced by incorporating journaling.

One of the major flaws of “traditional” file systems like ext2 is their low tolerance to abrupt system breakdowns (power failure or crashing software). Generally speaking, once the system is restarted, these types of events involve a very long examination of the file system's structure and attempts to correct errors, which sometimes results in an extended corruption. This corruption could cause partial or total loss of saved data.

Journaling answers this problem. To simplify, let's say that what we are doing is storing the actions (such as the saving of a file) before really doing it. We could compare this functionality to that of a boat captain who uses a log book to note daily events. The result: an always coherent file system. And if problems occur, the verification is very rapid and the eventual repairs, very limited. Therefore the time spent in verifying a file system is proportional to its actual use and not related to its size.

So ext3 offers journaling file system technology while keeping ext2's structure, ensuring excellent compatibility. This makes it very easy to switch from ext2 to ext3 and back again.

[Note]Note

As with ext2, it needs to be umounted to be resized.

1.1.3. ReiserFS

Unlike ext3, reiserfs was written from scratch. It is a journalized file system like ext3, but its internal structure is radically different because it uses binary-tree concepts inspired by database software and also has a variable block size, making it optimal for use with several (thousands or hundreds of thousands) of small files. It also performs well with big files, making it suitable for various uses.

[Note]Note

It can be resized “on the fly”, without umounting the file system.

1.1.4. JFS

JFS is the journalized file system designed and used by IBM. Proprietary and closed at first, IBM decided to open it to access to the free software movement. Its internal structure is similar to that of reiserfs.

[Warning]Warning

It can not be resized on GNU/Linux.

1.1.5. XFS

XFS is the journalized file system designed by SGI and also used with the Irix operating system. Proprietary and closed at first, SGI decided to open it to access by the free software movement. Its internal structure has lots of different features, such as support for real-time bandwidth, extents, and clustered file systems (but not in the free version).

[Warning]Warning

With GNU/Linux it can be resized for a bigger size only. You can't reduce it. Resizing can only be made with a mounted filesystem.

1.2. Differences Between File Systems

Table 9.1. File System Characteristics

 Ext2Ext3ReiserFSJFSXFS
StabilityExcellentVery GoodGoodMediumGood
Tools to restore erased filesYes (complex)Yes (complex)NoNoNo
Reboot time after crashLong, even very longFastVery fastVery fastVery fast
Status of the data in case of a crashGenerally speaking, good, but high risk of partial or total data lossVery goodMedium[a]Very goodVery good
ACL supportYesYesNoNoYes

[a] It is possible to improve results on crash recovery by journaling the data and not just the metadata, adding the option data=journal to /etc/fstab.

The maximum size of a file depends on many parameters (i.e. the block size for ext2/ext3), and is likely to evolve depending on the kernel version and architecture. According to the file system limits, the current maximum size is currently near or greater than 2 TeraBytes (TB, 1 TB=1024 GB) for ext2 or ext3 on standard 32 bits machines. JFS can go up to 4 PetaBytes (PB, 1 Pb=1024 TB). Unfortunately, these values are also limited to maximum block device size[23].

In kernel 2.6.X this block device limit can be extended using a kernel compiled with Large Block Device support enabled (CONFIG_LBD=y). For more information, consult Adding Support for Arbitrary File Sizes to the Single UNIX Specification, Large File Support in Linux, and Large Block Devices. With this and a file system which supports it you can reach up to 16 TB (on 32-bit machines) without special file-system tricks as is done by JFS for the file-system size. Files stored within it are limited to a smaller size.

1.3. And Performance Wise?

It is always very difficult to compare performance between file systems. All tests have their limitations and the results must be interpreted with caution. Nowadays, ext2 is very mature but its development is slow; ext3 and reiserfs are quite mature at this point. New features for reiserfs are included in Reiser4[24]. On the other hand XFS has a lot of features, and as time passes more of the advanced features work better on Linux. JFS took a different approach here, and they are integrating it on Linux feature by feature. This makes the process slower, but they also end up with a very clean code base. Comparisons done a couple of months or weeks ago are already too old. Let's not forget that today's hardware (specially concerning hard drive capacities) has greatly leveraged the differences between them. XFS has the advantage that just now it is the better performer with large streaming files.

Each system offers advantages and disadvantages. In fact, it all depends on how you use your machine. A simple desktop machine will be happy with ext2. For a server, a journalized file system such as ext3 is preferred. reiserfs, perhaps because of its genesis, is more suited to a database server. JFS is preferred in cases were file system throughput is the main issue. XFS is interesting if you need any of its advanced features.

For “normal” use, the four file systems give approximately the same results. reiserfs allows you to access small files rapidly, but it is fairly slow in manipulating large files (many megabytes). In most cases, the advantages brought by reiserfs' journaling capabilities outweigh its drawbacks. Notice that by default reiserfs is mounted with the notail option. That means that there is no optimization for small files.



[23] You may wonder how to achieve such capacities with hard drives that barely store between 320 and 400 GB. Using for instance one RAID card with 8 * 250 GB drives in RAID-striping, you can achieve 2TB of storage. Combining the storage of several RAID cards using GNU/Linux software RAID, or LVM (Logical Volume Manager) it should be possible to go even beyond (block size permitting) the 4TB limit.

[24] At press time, Reiser4 was not included in kernel 2.6.X