Omuuz

Why df and du show different Linux disk usage

Understand why df and du differ on Linux, including metadata, reserved blocks, open deleted files, permissions, sparse files, and mount boundaries.

Direct answer

df reports allocation for a filesystem, while du walks reachable directory entries and estimates their disk usage. Because they observe different layers, exact agreement is not expected; a large gap can point to deleted-but-open files, inaccessible paths, covered mount content, snapshots, reserved blocks, or filesystem metadata.

When this guide applies

  • df says a mount is full but the visible directory tree is much smaller.
  • Free space did not return after a pathname was removed.
  • You need to explain why a visual scan cannot account for every allocated block.

Step-by-step review

  1. Align the scope

    Compare df for the exact mount with du for that mount while controlling cross-filesystem traversal.

  2. Confirm units and semantics

    Check whether values are human-readable, bytes, blocks, logical size, or allocated usage.

  3. Record visibility gaps

    Permission failures and skipped mounts mean du-style traversal is incomplete.

  4. Investigate filesystem-only allocation

    Check for deleted-but-open files, snapshots, reserved blocks, metadata, and content hidden below a mount point using appropriate administrator tools.

  5. Re-measure after the owner acts

    Verify the same filesystem and scope rather than trusting an estimated reclaim value.

Technical context

The difference is architectural

GNU documents df as filesystem space reporting and du as hierarchy-based estimation. They are complementary tools rather than interchangeable calculators.

Deleted names can keep allocated data

Unlinking a pathname does not necessarily release its blocks immediately when a process still holds the file open.

Apparent size is another axis

du can report apparent size separately from allocated usage; sparse files make the distinction especially visible.

Exact reconciliation can be filesystem-specific

Snapshots, copy-on-write, compression, deduplication, and reserved space require tools and knowledge for the actual filesystem.

df and du answer different questions

Measuredfdu-style scan
Primary scopeMounted filesystemReachable paths below a directory
Needs a tree walkNoYes
Deleted-but-open dataStill allocatedNo pathname to visit
Unreadable directoriesIncluded in filesystem totalCannot be fully counted
Best useCapacity and free-space alertLocate visible directory consumers

Risks and actions to avoid

Do not force totals to match

Changing options until two numbers look equal can hide a scope or semantic mismatch.

Do not close processes casually

An open deleted file can belong to a critical service; coordinate a documented restart or log-reopen procedure.

Do not call the gap reclaimable

Some difference belongs to metadata, snapshots, reservations, or inaccessible data rather than disposable files.

What the Omuuz product can—and cannot—do

What it can do

SSH Disk Visualizer can keep filesystem capacity beside metadata-derived directory totals and show scan gaps so the two measurements are not conflated.

What it cannot do

It cannot enumerate an unlinked file by pathname, reconcile every filesystem feature, or claim that the difference can be reclaimed.

Product evidence

SSH Disk Visualizer directory tree and proportional storage blocks for a remote Linux scan.
A completed read-only scan turns remote metadata into a size-ranked directory map on the Mac.

Primary sources

Related guides

Linux disk full: read-only troubleshootingHow to find large files on a Linux serverHow to analyze remote Linux disk usage over SSH
View details — SSH Disk Visualizer