|
A journaling file system is a type of file system that keeps journalled metadata to avoid filesystem errors and corruption.
Problems with traditional file systems
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 any inconsistencies. Such programs include scandisk on Microsoft Windows, vrepair on Netware, and fsck on Unix and Unix-like systems (including Apple Mac OS X 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.
An answer: journaling file systems
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. Also, some filesystems that can journal all data can be configured to journal metadata only; metadata-only journaling often provides a performance boost.
Log-structured filesystems
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.
Alternatives to journaling
Soft updates work by properly ordering the metadata writes to guarantee consistency after a crash. Softupdates are the commonly used approach in the BSD operating systems. Note that, like journaling, softupdates do not guarantee that there will be no loss of data — they only guarantee consistency of the file system.
List of journaling file systems
Supported by the AIX operating system:
Supported by the Apple Macintosh operating systems:
- HFS Plus (Journaling was added to Mac OS X 10.2.2.)
Supported by HP-UX:
- VxFS (known to the HP system as "JFS", but differs from the IBM JFS)
Supported by the IRIX operating system:
Supported by the Linux operating system:
Supported by the Microsoft Windows NT and later operating systems:
- NTFS (Linux also has native read-only support for NTFS, read-write is only supported by commercial solutions )
Supported by the OpenVMS operating system:
Supported by the OS/2 operating system:
Supported by the Solaris Operating Environment:
Supported by Novell Netware 5.0 and up:
See also
|