Glossary

Journaling

Journalling is a technique used by modern filesystems to maintain consistency across crashes and power failures. Before a change is applied to the main filesystem, a record of it is written to a journal (a dedicated on-disk log). If the system crashes mid-write, the journal can be replayed to either finish the operation or roll it back, so the filesystem is never left in a structurally corrupt state.

ext3 introduced journalling to the ext family in 2001; ext4 continued it, with options for different levels of protection: data=journal (everything is journalled, slowest and safest), data=ordered (data is written before metadata, the default), and data=writeback (metadata journalled, data not ordered, fastest and least safe). XFS, JFS, ReiserFS, and NTFS all have their own journals.

Journalling protects metadata, not necessarily data. If a file's contents are being written when the power fails, a journalled filesystem guarantees that the directory entry and block pointers remain consistent—but the file's contents may be partially written. Applications that need crash consistency for their own data typically use fsync to flush buffers at key points, or rely on filesystem features like btrfs's copy-on-write that make atomic writes possible at the filesystem level.

Related terms: ext4, xfs

Also defined in: Textbook of Linux