Operations 5 min read

How to Quickly Identify Disk Space Hogs on Linux Servers

This guide shows Linux administrators how to use df, du, find, lsof, and tune2fs commands to locate large directories, uncover hidden space consumed by deleted files, and adjust filesystem reserved space, with step‑by‑step examples and screenshots.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How to Quickly Identify Disk Space Hogs on Linux Servers

Understanding Disk Space Alerts

When a server triggers a disk‑space warning, start by checking the overall usage with df -Hl, which displays human‑readable statistics for each mounted filesystem.

df output screenshot
df output screenshot

Finding Large Directories with du

A simple way is to run du -hs * in the root directory, which lists the size of each top‑level directory. To dig deeper, limit the depth of the search:

du -h -d 2 | grep [GT] | sort -nr
du -h --max-depth=2 | grep [GT] | sort -nr

These commands filter results that are measured in gigabytes (G) or terabytes (T) and sort them from largest to smallest.

du output screenshot
du output screenshot

Using find for Faster Searches

The find utility can locate files larger than a given size more efficiently: find / -type f -size +1G -exec du -h {} \; Because find scans the filesystem directly, it is often quicker and more flexible than repeated du calls.

Detecting Space Held by Deleted Files

Sometimes the total size reported by du is far less than the space shown as used by df. This discrepancy usually means that deleted files are still open by a process. List such files with: lsof +L1 The output may reveal a large log file (e.g., ~28 GB) that has been removed but remains allocated because the owning process still holds it open. Restarting the associated service (e.g., Tomcat) releases the space.

lsof output screenshot
lsof output screenshot

Adjusting Filesystem Reserved Space

Linux filesystems reserve a percentage of disk space (default 5 %) for the root user to prevent complete exhaustion. To change this reservation, use tune2fs: tune2fs -m 1 /dev/vda1 Setting the reserve to 1 % frees up the previously hidden space, as shown in the before‑and‑after screenshots.

tune2fs before/after screenshot
tune2fs before/after screenshot

Conclusion

By combining df, du, find, lsof, and tune2fs, administrators can quickly pinpoint the true culprits of disk‑space consumption, resolve hidden usage caused by deleted files, and fine‑tune filesystem reservations to avoid unexpected shortages.

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 spacefindlsofdutune2fs
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

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.