Operations 5 min read

How to Quickly Identify Disk Space Hogs on Linux Servers

When a Linux server triggers a disk‑space alert, you can pinpoint the offending directories or files by using df to view overall usage, du (with depth or max‑depth) or find to list large items, and lsof +L1 to detect deleted files still holding space, then optionally adjust reserved space with tune2fs.

dbaplus Community
dbaplus Community
dbaplus Community
How to Quickly Identify Disk Space Hogs on Linux Servers

Understanding Disk Space Alerts

During routine server operations, administrators often receive alerts indicating that disk space is running low. The first step is to verify the reported usage with df -Hl, which shows the overall filesystem statistics.

Finding Large Directories with du

A straightforward method is to run du -hs * in the root directory, which lists each top‑level directory and its size. Repeating the command in subdirectories narrows down the culprit.

For a more efficient search, use the depth option of du (e.g., du -h --max-depth=2) and pipe the output to grep to filter entries that show sizes in G or T.

Using find to Locate Large Files

The find command can directly list files larger than a given size, which is often faster and more flexible than du: find / -type f -size +1G -exec du -h {} \; This command searches the entire filesystem for regular files exceeding 1 GB and displays their sizes.

Detecting Deleted Files Still Holding Space

Sometimes the space reported by df does not match the sum of sizes shown by du. This discrepancy usually means that deleted files are still open by a process, preventing the space from being reclaimed.

Use lsof +L1 to list such files: lsof +L1 The output often reveals large log files that have been removed but are still held by a running service (e.g., a 28 GB log file). Restarting the associated service (such as Tomcat) releases the space.

Adjusting Reserved Space with tune2fs

Linux filesystems reserve a percentage of disk space for the root user (default 5%). This reservation can make it appear that some space is “missing.” To change the reserved percentage, run: tune2fs -m 1 /dev/vda1 After adjusting the reservation, the previously hidden space becomes available, as shown in the before‑and‑after screenshots.

Conclusion

By combining df, du, find, and lsof, administrators can quickly locate the directories or files that consume excessive disk space, identify hidden usage caused by deleted but still‑open files, and adjust filesystem reservations with tune2fs to reclaim space.

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 spacefindlsofdudftune2fs
dbaplus Community
Written by

dbaplus Community

Enterprise-level professional community for Database, BigData, and AIOps. Daily original articles, weekly online tech talks, monthly offline salons, and quarterly XCOPS&DAMS conferences—delivered by industry experts.

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.