Operations 5 min read

How to Quickly Identify Disk Space Hogs on Linux Servers

This guide explains how to diagnose unexpected disk usage on Linux by using df, du, find, and lsof commands, demonstrates efficient ways to locate large directories or deleted files, and shows how to adjust reserved space with tune2fs to reclaim lost storage.

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

During server operations, disk space alerts are common; you can start by checking usage with df -Hl.

The goal is to pinpoint the directories or files that consume the most space.

Method 1 – Simple du scan : Run du -hs in the root directory to list each top‑level directory’s size, then repeat the command in the larger directories to drill down.

Method 2 – Depth‑limited du with filtering : Use du’s depth options together with grep to show only entries measured in gigabytes or terabytes and sort them.

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

This quickly surfaces the biggest consumers.

Method 3 – Using find : The find command can locate large files more efficiently.

find / -type f -size +1G -exec du -h {} \;
find

is generally faster and more flexible than du for this purpose.

Sometimes the total size reported by du does not match df because deleted files are still held open by processes. List such files with: lsof +L1 In the example, a ~28 GB log file had been deleted but its space was not released; restarting the Tomcat service freed the space.

Another common discrepancy is that df shows used + available less than the total size. Linux filesystems reserve a percentage (default 5 %) of space for the root user to ensure critical services can continue when the disk is full.

You can modify this reservation with tune2fs: tune2fs -m 1 /dev/vda1 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.

Operationslinuxdisk 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.