Journaling file system

from Wikipedia, the free encyclopedia

A journaling file system is a file system that records all changes before the actual writing in a memory area reserved for this, the journal . This means that it is possible to reconstruct a consistent state of the data at any time, even if a write process was aborted at any point. This feature is useful in the event of system crashes or power outages. With conventional file systems after such incidents, the check of the entire file system with often unsuccessful repair attempts can be omitted. Particularly in the case of large hard disks with partitions over 100 gigabytes , this also saves a considerable amount of time when booting , as checking them can take several hours.

A distinction is made between metadata journaling and full journaling. While metadata journaling only guarantees the consistency of the file system, full journaling also guarantees the consistency of the file contents. The general term journaling is often used colloquially when actually metadata journaling is meant.

File system update issues

A file system stores information about files and file-like objects (especially directories) by assigning data to a name. There are several ways of doing this, and each file system uses structures that are somewhat similar, but never entirely identical. What all file systems have in common, however, is that changes to files (this also includes creating, moving, renaming or deleting) require write operations in several places on the mass storage device. If you perform the first write operation, the file system is no longer in a consistent state (it contains changes but not all changes; the semantics here are: It is assumed that completed write operations have moved the file from one consistent state to another have transferred), if you complete the last write process, the file system is consistent again. However, if the computer has to be restarted in the meantime (be it because of a crash, a power failure or pressing the reset button), the file system must first be examined for such errors before you can safely work with it again. If you skip such a test, the following write operations can lead to serious consequential errors, which in the worst case can lead to the total loss of all data.

Function of journaling

The journaling concept counteracts this problem. Suppose the user wants to move a file D from the directory V1 to the directory V2. Then two write operations must be carried out: On the one hand, the old entry on D must be removed from the directory V1, and on the other hand, the new entry D must be added to the directory V2. The latter can make it necessary to enlarge the directory V2, which would then result in further changes. All of these changes are not made where they actually belong, but are first written to a special area in the file system, the so-called journal. There is then z. B. qualitative:

  • Remove entry D from directory V1
  • Add entry D to directory V2

However, this procedure alone does not yet achieve the desired goal of security against incomplete operations, since here again in the middle of the operation - perhaps coincidentally exactly after "Remove entry D from directory V1" but before "Add entry D to directory V2" - the system crashes. Therefore, the journal must be closed from time to time. It records how many changes have been made up to this point, and a checksum ensures that the data is correct. A move operation should therefore start with the creation of the file in the new location, then copy all data and end with the deletion of the directory entry and thus also the release of the hard disk space on the source data carrier.

Selection of journaling file systems

The UFS file systems used under BSD use a technique called soft updates , which takes a similar approach in terms of objectives.

Journaling file systems are now standard and available on many free, commercial, and alternative operating systems.

Web links