What Is a Journaling Filesystem

A journal, with respect to filesystems, is an area of the disk that is used to store information about pending changes to that filesystem. Filesystems contain two general types of information: the actual files and directories where your data is stored, and filesystem metadata, which is internal information about the filesystem itself (where the data for each file is physically stored, which directories contain which files, and so on). When you write to a file in a journaling filesystem, the changes that you want to make are written to the journal rather than directly to the file. The filesystem then asynchronously applies those changes to the specified file and updates the filesystem metadata only when the modified file data has been successfully written to the file in question. Journaling helps guarantee that a filesystem is always in a consistent state. When you reboot a Linux system, Linux checks the consistency of each filesystem (using a program called fsck, for file system consistencycheck) before mounting it. If a filesystem requires repair because its consistency cannot be verified, the fsck process can take a long time, especially on larger disks. Enterprise systems tend to require journaling filesystems because of the lower risk of data corruption and to minimize the time it takes to restart the system.

Historically, the standard Linux filesystem was EXT2, which is a fast, simple filesystem that does not have a journaling feature. When a system that uses EXT2 filesystems crashes, the EXT2 metadata must be scanned thoroughly and compared to the data that is actually on the disk to correct any chance of data corruption. On a large system, this consistency check can take, at best, minutes and, at worst, an hour or two. Journaling filesystems introduce a small overhead for all write operations, but the greater assurances of data consistency and the fact that modern drives are very fast make them an attractive choice for use on most modern Linux systems. When Linux began to move into the enterprise space, both Red Hat and SUSE were keen to provide a journaling filesystem so the two companies sponsored the development of the EXT3 and Reiser filesystems.

In certain situations, the use of a journaling filesystem can be a bad idea — most notably with databases that store their data in a standard Linux filesystem but that keep their own log of changes to those data files and are able to recover data using their own internal methods. Oracle is a good example of a database that provides its own methods to guarantee the consistency of its data files.

Was this article helpful?

0 0

Post a comment