Operations 5 min read

How to Quickly Identify Disk Space Hogs on Linux Servers

This guide explains how to use Linux commands such as df, du, find, and lsof to quickly locate directories, files, or deleted resources that are consuming disk space, and shows how to adjust reserved space with tune2fs to recover seemingly missing storage.

Efficient Ops
Efficient Ops
Efficient Ops
How to Quickly Identify Disk Space Hogs on Linux Servers

During server operations, disk space alerts are common. First, run df -Hl to view current usage and verify the alert.

How to Find Large Directories or Files Consuming Disk Space?

A simple way is to start at the root directory and execute du -hs to list the size of each top‑level directory, then drill down into the larger ones.

A more efficient method uses du with the -d or --max-depth option to limit the depth of the search, and pipes the output to grep to filter for entries measured in G or T, then sorts the results.

Alternatively, the find command can locate large files directly: find / -type f -size +1G -exec du -h {} \; In terms of performance, find is generally faster and more flexible than du for this purpose.

These techniques help you quickly pinpoint the directories or files that are hogging disk space.

Why Is Disk Space Mysteriously Consumed?

Sometimes the total size reported by du does not match the usage shown by df. For example, df may indicate 37 GB used, while summing du -hs across the filesystem yields only about 10 GB. This discrepancy often means that deleted files are still holding space because they remain open by a process.

You can reveal such orphaned files with lsof +L1: lsof +L1 The output may show a large log file (e.g., ~28 GB) that has been deleted but not released. Restarting the associated service (e.g., Tomcat) frees the space.

Another common confusion arises when the sum of Used and Avail is less than Size. Linux reserves a percentage of disk space (default 5 %) for the root user as a safety buffer, ensuring critical applications have room even when the disk appears full.

You can adjust this reserved space with tune2fs -m 1 /dev/vda1 to set the reservation to 1 %.

After reducing the reserved percentage, the previously “missing” space becomes available.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

linuxdisk spacefindlsofdudf
Efficient Ops
Written by

Efficient Ops

This public account is maintained by Xiaotianguo and friends, regularly publishing widely-read original technical articles. We focus on operations transformation and accompany you throughout your operations career, growing together happily.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.