Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk5 min

Why fsync() Can Still Lose Your Data: Linux Durability Explained

Linux fsync() requests persistence for a file, but durable updates also depend on directory metadata, correct ordering, error handling, and storage that honors flushes.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

fsync() is a real persistence request, not an absolute guarantee that a change will survive every crash. On Linux, it asks the kernel to synchronize a file’s modified data and associated metadata to the storage device. Whether the change survives depends on more than the file: the directory entry may need its own sync, the application must order updates correctly, and the storage stack must honor its flush requests.

What does a successful fsync() promise?

On Linux, fsync() requests that modified file data and associated metadata be synchronized to the storage device. A successful return means the request completed according to the operating system and storage stack’s contract; it is not independent proof that every layer—from filesystem to device firmware—has made the data immune to every failure. The Linux manual also notes that writeback errors can be reported by a later write or synchronization call, so applications need to check the return value rather than treating the call as a formality. Linux man-pages: fsync(2)

As an Amazon Associate I earn from qualifying purchases.

Why can a file’s name disappear even if its contents were synced?

A file’s bytes and the directory entry that gives the file its name are separate pieces of filesystem state. Syncing the file does not necessarily persist the containing directory entry. As the Linux manual puts it: “Calling fsync() does not necessarily ensure that the entry in the directory containing the file has also reached disk.” Linux man-pages: fsync(2)

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

This matters when an application creates a file or replaces one by renaming a temporary file. A typical design must account for syncing the new file’s contents and the directory updates that make its name or replacement durable. The exact sequence depends on the platform, filesystem, and operations involved; do not assume that syncing the file alone also commits its name.

Why doesn’t journaling make every recent write durable?

Filesystem journaling primarily helps the filesystem recover its structures consistently. It does not automatically make every application write durable. The distinction is visible in the Linux kernel’s ext4 documentation, which is specific to ext4 and its documented configuration options—not a rule for every filesystem.

ext4 write modes and delayed allocation

In ext4’s data=writeback mode, data ordering relative to metadata journal commits is not preserved. The documentation also describes how delayed allocation can leave older data at risk during a power loss. These examples show why “the filesystem is journaled” does not answer whether a particular application update has reached stable storage. The outcome depends on the filesystem’s behavior, mount configuration, and the application’s synchronization protocol. Linux kernel documentation: ext4, version 6.7

How can a storage cache undermine the request?

The synchronization request has to reach the persistence boundary and be honored there. A device may use a volatile write cache; if a lower layer reports that a flush completed before data has reached nonvolatile media, the application can believe it has persisted data that remains vulnerable to power loss.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

SQLite’s atomic-commit documentation explains this as a portability assumption: software relies on the operating system and hardware to report synchronization correctly. Its warning about disk controllers acknowledging data before it reaches the medium is historical explanatory wording, not evidence that every current device behaves this way. Without model-specific evidence, it is more accurate to say that durability depends on the device’s documented cache and flush behavior than to claim that modern hardware generally misreports writes. SQLite: Atomic Commit

How are atomicity, crash consistency, and durability different?

  • Atomicity asks whether an operation appears all-or-nothing under a defined failure model.
  • Crash consistency concerns whether the filesystem or application can recover to a valid state after a crash.
  • Durability asks whether committed data persists through the failures the system claims to handle.

These properties are related, but none automatically supplies the others. An atomic block write may prevent a torn write while still requiring a persistence operation. An application-level atomic update also needs correct ordering and a recovery strategy.

ext4 atomic writes are a separate, conditional feature

The Linux kernel documents ext4 atomic-write support with explicit requirements, including Direct I/O and suitable underlying hardware. It is not a general replacement for fsync(), and its availability does not remove the need to understand the application’s persistence and recovery protocol. Linux kernel documentation: ext4 atomic writes

What should an application do when synchronization fails?

Check the return value of fsync() and treat an error as a failure to establish the requested persistence—not as confirmation that the data is safe. A write may have appeared to succeed before an error is reported during later writeback, and blindly retrying is not a universal fix: the application needs to know what state may have reached storage and how its recovery process handles that state. Linux man-pages: fsync(2)

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Failure handling is not merely theoretical. A 2020 USENIX ATC study injected block I/O failures and examined selected workloads on ext4, XFS, and Btrfs. It found varied failure reporting and application recovery behavior. That study demonstrates the complexity of handling sync failures in the configurations it tested; it does not establish a universal failure rate or predict every system’s behavior. USENIX ATC 2020 paper

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How can you evaluate a durability design?

There is no universal ranking of filesystems, devices, or application protocols for durability. Evaluate the combination against the failures it is meant to withstand:

  • Failure model: Is the concern a process crash, operating-system crash, sudden power loss, or a lower-layer I/O failure?
  • State being committed: Does the design cover file contents as well as the directory metadata needed to find or replace the file?
  • Storage behavior: Are volatile caches involved, and does the device document power-loss protection and flush behavior?
  • Error recovery: If a write or sync reports an error, can the application determine what to recover, or must it validate and rebuild state?
  • Cost: What performance impact follows from the chosen synchronization and recovery protocol?

A UPS for a home server can provide time for a controlled shutdown during a mains-power interruption. It cannot guarantee durable writes against operating-system crashes, filesystem bugs, or storage-firmware failures. Storage with documented power-loss protection may address a different part of the risk, but the specific device and its documented capabilities matter.

Where does this explanation apply?

The syscall and filesystem examples here are Linux-centered, with the ext4 behavior tied to the kernel’s version 6.7 documentation and the cited ext4 configuration. The sources cited here do not establish equivalent behavior for Windows, macOS, network filesystems, virtualized storage, cloud block storage, or particular current device models. For those environments, the relevant operating-system, filesystem, provider, and hardware contracts need to be checked directly.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.