Finding the Disk Space Culprit

Disk space does not just disappear. It gets taken.

When a system runs out of space, the problem is rarely the disk itself. The problem is not knowing what is consuming it. du exists for that exact moment. It tells you where the space went, not where you hope it went.

Most people use du only after things are already broken. That is too late. du is a diagnostic tool, not a panic button.

1. Stop Guessing. Measure Directories Directly.

Filesystem issues are not solved by intuition.

That’s why we have du because it reports actual disk usage, not file sizes, not estimates, and not assumptions.

Example: Check total usage of a directory:

du -sh /var/log

This answers a concrete question. How much space is this directory really using.

If you are troubleshooting disk pressure, this is your starting point.

2. Depth Matters More Than Detail.

Raw du output is overwhelming. You need structure.

Example: See top level usage only:

du -h --max-depth=1 /var

This gives you a map, not a wall of text.

Once you see which directory is growing, you can drill down intentionally instead of spelunking blindly

3. Sort Before You Scroll.

Scrolling is not analysis but when paired with sorting du actually becomes useful.

Example: Find the largest directories under home:

du -h /home | sort -hr | head

This immediately surfaces the problem areas.

If you are still scrolling through output, you are wasting time and missing patterns.

4. Files Lie. Blocks Do Not.

File size does not equal disk usage.

Sparse files, deleted but open files, and filesystem block allocation all distort what ls shows you. du reports what the filesystem is actually allocating.

Example: Compare apparent size versus real usage:

du -h --apparent-size largefile

If numbers do not match expectations, du is telling you something important about how storage is being consumed.

5. Du Belongs in Routine Checks, Not Emergencies.

Disk issues rarely appear instantly. They creep.

Taht’s whu du is ideal for periodic checks, cron jobs, and baseline comparisons.

Example: Snapshot directory growth over time:

du -sh /srv/data >> disk_usage.log

This creates historical evidence. Evidence beats guesswork every time.

The Mindset Shift

So, du is not about cleaning space. It is about accountability!

Every gigabyte has an owner.
Every spike has a cause.
Every outage leaves a trail.

du gives you the trail.

Used early, it prevents outages. Used late, it explains them. Either way, it tells the truth.

In the next post, we will move to df, because knowing where space went is only half the story. Knowing what the filesystem believes is available is the other half.