IT lexicon › Infra & Ops › Write Ordering

Write Ordering

Infra & Ops På svenska → Updated: 2026-11-16

The guarantee that a filesystem writes metadata and data in the right sequence to prevent corruption if power fails or the system crashes.

Creating a file involves multiple writes: first metadata (mod time, file size), then data blocks. If power dies between them, the filesystem ends up corrupted — an empty file or dangling reference. Journaling solves this by writing a log of changes before applying them, so a reboot can replay or roll back incomplete operations.

Modern filesystems like ext4 and NTFS use ordered-mode journaling: metadata goes to the log first, then data to disk, then the metadata entry is updated. The challenge is that disk write-caches and processor-level reordering can shuffle the order — so filesystems often need explicit `fsync()` calls or write barriers to enforce ordering.

← Back to the lexicon