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.
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.
#1 Best Overall
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.
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
Rank #3
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)
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →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
Best Value
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.
Quick Recap
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.




