About this article
This article was created using an automated generation workflow utilizing generative AI. We reviewed the GNU Coreutils df/du specifications and organized a procedure to separate "what the numbers are measuring" when a space shortage occurs, rather than starting with deletion. Re-execution on an actual Ubuntu machine has not been performed.Verification Status: 📘 GNU Official Specification Verified / Ubuntu Actual Machine Unverified
Information Verification Date: October 2, 2026.
Both df and du are commands for viewing disk usage, but they do not measure the same target using the same method.
First, inspect as read-only
TARGET="\${1:-$HOME}"
df -h "$TARGET"
du -sh "$TARGET"
df is the entry point for viewing usage on the filesystem side. du traverses a specified directory and aggregates the usage of the files it finds.
Isolate the reasons why the numbers differ
df views the entire filesystem
du only views the specified path and below
There are locations that du cannot traverse due to permissions
They differ in whether they include separate mounts
Files that have been deleted but are still held open by processes may be difficult to detect through path-based aggregation alone
Change one location
TARGET="$HOME/Downloads" df -h "$TARGET" du -sh "$TARGET"
Observe that even though df targets the same filesystem, du's aggregation scope becomes smaller.
flowchart TD A["容量が合わない"] --> B["df: filesystem"] A --> C["du: path走査"] B --> D["対象mount"] C --> E["範囲/権限"] D --> F["差を切り分け"] E --> F
For professional use
When storage is constrained, do not rush to delete files; instead, use df to identify the target filesystem and du to narrow down the scope.
How to interpret "different numbers for the same disk"
The discrepancy between df and du does not necessarily mean one of them is wrong. df views disk usage from the filesystem, whereas du traverses the directory tree and accumulates the found files. In other words, their observation points differ.
Particularly in troubleshooting incidents, there is a phenomenon where "df does not recover even after deletion." If a process keeps a deleted file open, the space may not be released yet, even if it is hard to notice from the directory name. Although this minimal experiment does not reproduce that scenario, it serves as the next investigative candidate when a df/du discrepancy persists.
It is also important not to confuse the target path of du with the mount point indicated by df. Following the order of identifying the filesystem first and then narrowing down to the directory level helps reduce accidents where large files are deleted in a panic.
