A journaling file system is a type of file system that keeps journalled metadata to avoid filesystem errors and corruption.
In the process of writing data to the hard disk, a file system must write out metadata, which is information about the data on the disk, for example, the location of the data or the names of the files. If, while the file system is writing this metadata, the hard disk is interrupted by, for example, a loss of power, the metadata is not completely written out and the filesystem may be in an inconsistent state, in which the description of the data does not fully match the data itself.
One approach to fixing this problem is to run a program that scans the entire hard disk when the system is restarted, to fix an inconsistencies. Such programs include fsck on Unix and Unix-like systems, scandisk on Microsoft Windows systems, and Disk First Aid on Apple Macintosh systems. Unfortunately this method has two problems. First, rescanning the entire disk is very time consuming. Second, there is the possibility that the scanning program will encounter errors that it cannot fix and that data will be lost.
Journaling file systems approach this problem by writing out a special file called a "journal", which keeps track of the transactions to the disk. Updates to the disk are then committed atomically.
If power is suddenly interrupted, a given set of updates will have either been fully committed to the filesystem, in which case there is not a problem, and the filesystem can be used immediately, or will be marked as not yet fully committed, in which case the file system driver can read the journal and fix any inconsistencies that occurred.
This is much quicker than a scan of the hard disk, and guarantees that the structure of the filesystem is always self-consistent, even if power is interrupted or the system crashes at random times, providing that the journal rollback or commit process is carried out when re-mounting the filesystem.
Note that this does not guarantee zero data loss: data or file-system changes written between the last commit and a crash may be lost, with the filesystem being effectively rolled back to the last commit point.
Some journaling filesystems journal all data, others only journal filesystem metadata.
Some systems go one step beyond being a conventional filesystem with an added journal; they use the journal log itself as the fundamental basis for the filesystem. These types of systems are called log-structured filesystems. As of 2003, none of the most popular filesystems are log-structured, although log-structured filesystem concepts influenced the development of the WAFL filesystem.
Supported by the Linux operating system:
Problems with traditional file systems
The answer: journaling file systems
Log-structured filesystems
List of journaling file systems
Supported by the Apple Macintosh operating systems:
Supported by the IRIX operating system: