Flush All Pending Disk Writes with sync

Make sure cached writes physically land on disk before unplugging a drive or killing power.

LinuxfilesystemdiskclisyncLow risk
Run sync (optionally with a target: sync /path/to/mount) and wait for the prompt to return — all cached writes are then on storage.

01Command

Command
$ sync

02What it does

Linux caches writes in memory for speed, so 'the copy finished' in the file manager does not mean the data is on the platter or flash chip yet. sync asks the kernel to flush dirty pages and buffers for all filesystems, or just one when you pass a file or mount point (GNU coreutils extension). It returns only after the kernel reports the data is on persistent storage, which is why a large USB copy can appear stuck for a while after the progress bar ends.

03Risk

RiskLow risk
Requirementscoreutils (preinstalled)
!Warning: sync does not unmount anything — for USB drives still use a proper eject/umount; and if sync hangs for minutes, the disk may be failing.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • sync(1) — Linux man page
    man7.org · community · 2026-09-17
    Evidence: Man page states sync 'synchronize cached writes to persistent storage' and documents -f/--data and -d options; confirms 'sync' and 'flush' semantics in the text.
  • sync(1) — Debian man page (coreutils)
    Debian manpages · community · 2026-09-17
    Evidence: Man page describes flushing file system buffers: 'force changed blocks to disk, update the super block', confirming the flush behavior.

Last verified: 2026-09-19 · Category: Files & Folders

06Related solutions