Chapter 8. The Linux Filesystem

Table of Contents
8.1. Comparison of a Few Filesystems
8.1.1. Different Usable Filesystems
8.1.2. Differences Between those Filesystems
8.1.3. And Performance Wise?
8.2. Everything is a File
8.2.1. The Different File Types
8.2.2. Inodes
8.3. Links
8.4. "Anonymous" Pipes and Named Pipes
8.5. "Special" Files: Character Mode and Block Mode Files
8.6. Symbolic Links, Limitation of "Hard" Links
8.7. File Attributes

Naturally, your GNU/Linux system is contained on your hard disk within a filesystem. Here we present different aspects related to filesystems, as well as the possibilities they offer.

8.1. Comparison of a Few Filesystems

During the installation, you can choose different file systems for your partitions. This means you can format your partitions according to different algorithms.

Unless you are a specialist, choosing a filesystem is not obvious. We propose a rapid presentation of three of the most current file systems, which are all available under Mandrake Linux.

8.1.1. Different Usable Filesystems

8.1.1.1. Ext2FS

The Second Extended Filesystem (its abbreviated form is Ext2FS or simply ext2) has been GNU/Linux's default filesystem for many years. It replaced the Extended File System (that's where the "Second" comes from). The "new" filesystem corrected certain problems and limitations.

Ext2FS respects the usual standards for Unix-type filesystems. Since its conception, it was destined to evolve, while still offering a great robustness and good performances.

8.1.1.2. Ext3

Like its name suggests, the Third Extended File System is Ext2FS' successor. It is compatible with the latter but it is enhanced by a very interesting feature: journaling.

One of the major flaws of "traditional" filesystems like Ext2FS is their low tolerance to abrupt system breakdowns (power failure or crashing software). Generally speaking, such events involve a very long exam of the filesystem's structure, attempts to correct errors, sometimes resulting in an extended corruption. Hence, a partial or total lost of saved data.

Journaling answers this problem. To simplify, let's say that the object is to save actions (such as the saving of a file) before really doing it. We could compare its functioning to the one of a boat captain whom notes in his log book daily events. The result: an always coherent filesystem. And if problems occur, the verification is very rapid and the eventual repairs, very limited. The time spent to verify a filesystem is thus proportional to its actual use and no more its size.

Hence, Ext3FS offers the journal filesystem technology, while keeping Ext2FS' structure – ensuring an excellent compatibility.

8.1.1.3. ReiserFS

Unlike to Ext3FS, ReiserFS is created from scratch. It is journalized like Ext3FS, but its internal structure is radically different. Specifically, it uses binary-tree concepts inspired by database software.

8.1.1.4. JFS

JFS is the journalized filesystem designed and used by IBM. Proprietary and closed at first, IBM recently decided to open the access to free software movement. Its internal structure is near to ReiserFS' one.

8.1.2. Differences Between those Filesystems

Table 8-1. Filesystem Characteristics

 Ext2FSExt3FSReiserFSJFS
StabilityExcellentGoodGoodMedium
Tools to recuperate erased filesYes (complex)Yes (complex)NoNo
Reboot time after crashLong, even very longFastVery fastVery fast
Sum of the data in case of a crashGenerally speaking, good, but high risk of partial or total data lossN/AVery good. Complete data loss is very rareVery good

About file maximum sizes, it depends on a lot of parameters (e.g. as block size for ext2/ext3), and is likely to evolve depending on the kernel version and architecture. Nonetheless, the minimum available, according to the filesystem limits, is currently generally near or superior to 2Tb (1Tb=1024 Gb) and can go up to 4Pb (IPb=1024 Tb) for JFS. Unfortunately, thess values are also limited to maximum block device size, which in current 2.4.X kernel is limited (for X86 arch only) to 2TB[1] even in RAID mode. For more information, consult Adding Support for Arbitrary File Sizes to the Single UNIX Specification.

8.1.3. And Performance Wise?

It is always very delicate to compare performances. Every tests have their limitations and the results must be interpreted with caution. Nowadays, Ext2FS is very mature but its development is scarce; on the other hand, journal filesystems like Ext3FS and ReiserFS evolve very rapidly. Tests done a couple of months or weeks ago are already too old. Let's not forget that today's material (specially concerning hard drive capacities) has greatly leveraged the differences between them. However JFS is currently the one showing best performances.

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 Ext2FS. For a server, a journalized filesystem Ext3FS is preferred. ReiserFS, perhaps because of its genesis, is more suited to a database server. JFS is itself preferred in cases were filesystem throughput is the main issue.

For a "normal" use, the four filesystems give approximately the same results. ReiserFS allows to access small files rapidly, but it is fairly slow to manipulate large files (many megabytes). In most cases, the advantages brought by ReiserFS' journaling capabilities render its drawbacks to be of minimal importance.

Notes

[1]

You may wonder how to achieve such capacities with hard drives that hardly reach 180Gb. In fact, using 3 RAID cards hosting each 8*128Gb drives, you reach 3Tb...


Tux on Star from MandrakeSoft Linux is a registered trademark of Linus Torvalds. All other trademarks and copyrights are the property of their respective owners.
Unless otherwise stated, all the content of these pages and all images are Copyright MandrakeSoft S.A. and MandrakeSoft Inc. 2002.
http://www.mandrakelinux.com/