Operations 5 min read

How to Quickly Identify and Resolve Disk Space Exhaustion on Linux

This guide explains how to verify disk alerts, locate large directories and files using df, du, and find commands, handle discrepancies caused by deleted files, and adjust system-reserved space to efficiently free up disk space on Linux servers.

Su San Talks Tech
Su San Talks Tech
Su San Talks Tech
How to Quickly Identify and Resolve Disk Space Exhaustion on Linux

Most common alerts are memory or CPU, but disk alerts can also occur. When a disk full alert appears, first verify it with df -Hl to see which partition is full.

How to Locate Large Disk Space Consumers

To locate large directories, run du -hs at the root, or use du -d 2 or du --max-depth=2 combined with grep and sort -nr to filter big directories.

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

For faster results, the find command can directly locate files larger than 1 GB:

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

Inconsistent Disk Space Reports

If the size reported by du or find differs from df, it may be due to deleted files that still hold space. Use lsof +L1 to list such files.

lsof +L1

Often a deleted log file still occupies dozens of gigabytes; restarting the related service (e.g., Tomcat) releases the space.

System-Reserved Disk Space

Sometimes the used and available space reported by df does not sum to the total because the system reserves a percentage (default 5 %) for the root user. Adjust the reserved space with tune2fs -m 1 /dev/vda1 to keep only 1 GB.

tune2fs -m 1 /dev/vda1
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.

linuxtroubleshootingcommand-linedisk spacesystem operations
Su San Talks Tech
Written by

Su San Talks Tech

Su San, former staff at several leading tech companies, is a top creator on Juejin and a premium creator on CSDN, and runs the free coding practice site www.susan.net.cn.

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.