Advanced Topic 39 of 51 Operating Systems
Journaling File Systems
File systems logging changes to recover after crashes.
How it works
A journaling file system records intended changes to metadata, and optionally data, in a log called the journal before applying them to the main structures. After a crash or power loss, it replays or discards the journal entries to restore consistency quickly instead of scanning the whole disk with fsck. Modes include writeback, ordered and full data journaling, with different safety and performance trade-offs.
Step-by-step walkthrough
- The application changes a file.
- The change is first written to the journal and committed.
- Then it is applied to the main file system.
- After a crash the journal is replayed.
- The file system returns to a consistent state without a long scan.
Where it is used
ext3, ext4, NTFS, XFS and JFS use journaling to protect against corruption. Databases use the same write-ahead logging idea.
Common pitfall
Journaling protects file-system consistency, not necessarily the contents of your latest writes, unless full data journaling or fsync is used. Disk caches that lie about flushes can defeat it. Journal writes add overhead, and a small or corrupted journal limits recovery. Copy-on-write file systems such as ZFS and Btrfs take a different approach.
Where it fits in the course
Journaling File Systems is topic 39 of 51 in Operating Systems, rated Advanced. It follows File Allocation Methods. The next topic is Disk Scheduling.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the Operating Systems quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the Operating Systems quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is Journaling File Systems?
Where do people use Journaling File Systems?
What is the most common mistake with Journaling File Systems?
What should I learn before this topic?
How can I practice it?
Is Journaling File Systems hard to learn?
How long does it take to learn Journaling File Systems?
Which topics are related to Journaling File Systems?
What should I study after Journaling File Systems?
Related topics
- File Allocation Methods (Operating Systems)
- Disk Scheduling (Operating Systems)
- Directory Structures (Operating Systems)
- I/O Management (Operating Systems)
- Distributed File Systems (Distributed Systems & Cloud)
- Number Systems (Math for Computing)
- Linux File System Layout (DevOps & Tooling)