Diagnosing Disk Space Issues on Linux with df and du Commands
This article walks through troubleshooting a failed deployment caused by a full disk, showing how to use df -h to check overall disk usage and various du options (including --max-depth and -sh) to pinpoint large directories and resolve the issue.
While publishing a test service via a web release platform, one of two nodes failed to start, causing TPS to stay low; log inspection revealed an "IO" error indicating the disk was full.
Check overall disk space: use the command
df -hto display free space on all mounted filesystems.
View usage per subdirectory: run
du --max-depth=1 -h(default path is the current directory). The
-hflag makes sizes human‑readable (K, M, G). The output lists each subdirectory’s size and a total line.
Get the size of a specific directory: use
du -sh. This prints a summarized, human‑readable size for the current directory.
Alternative command:
du --max-depth=0 -hproduces the same result as
-s, showing only the total size.
You can also specify a path, e.g.,
du -sh /root/sw, to check the size of a particular directory.
Raymond Ops
Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.