External Publication
Visit Post

Linux Disk Usage Explained Simply

DEV Community [Unofficial] June 17, 2026
Source

One of the fastest ways to break a Linux system is this:

❌ Running out of disk space

When disk fills up:

apps crash logs stop writing deployments fail servers become unstable

πŸ‘‰ That’s why disk usage monitoring is critical in Linux and DevOps.

Let’s simplify it.

Disk Usage Basics (You Must Know This First)

What is Storage in Linux?

Storage is where Linux keeps:

  • Files
  • Applications
  • Logs
  • Databases

Examples:

  • HDD
  • SSD
  • Cloud volumes (AWS, etc.)

If storage becomes full:

  • Applications may crash
  • Logs may stop writing
  • System can become unstable

Linux uses storage through filesystems.

What is a Filesystem?

A filesystem is how Linux organizes storage.

Examples:

  • ext4
  • xfs

Linux mounts filesystems into directories like:

  • /
  • /home
  • /var

File Size vs Disk Usage

  • File size β†’ Size of a single file
  • Disk usage β†’ Total space consumed by files and directories

Commands:

  • ls -lh β†’ Check file size
  • du -sh β†’ Check directory disk usage

What is Mounting?

Linux attaches storage devices to directories using a process called mounting.

Examples:

  • / β†’ Main filesystem
  • /home β†’ User files
  • /var β†’ Logs and application data

This is why df -h shows a Mounted on column.

1. Check Overall Disk Usage with df

df -h

Example Output:

Filesystem      Size  Used  Avail  Use%  Mounted on
/dev/sda1        50G   32G   18G   65%   /

Meaning:

  • Size β†’ Total disk
  • Used β†’ used space
  • Avail β†’ Free space
  • Use% β†’ usage percentage
  • Mounted on β†’ where disk is attached

πŸ‘‰ First command to run when server behaves weirdly.

2. Check Folder and Directory Size with du

du -sh /home
du -sh /var/log
  • -s β†’ Summary (total size only)
  • -h β†’ Human readable (KB, MB, GB)

πŸ‘‰ Used to find which folder is consuming space

3. Find Large Files in the System

find / -type f -size +100M 2>/dev/null
find / -type f -size +500M 2>/dev/null

⚠️ Can take time on large systems.

πŸ‘‰ Common use:

large logs backups unused media files

4. Find Biggest Directories (Very Important)

du -sh /* 2>/dev/null | sort -hr | head -n 10

πŸ‘‰ Shows top 10 largest directories

This is one of the most used DevOps troubleshooting commands.

5. Disk Full but Space Looks Free? (INODES)

df -i

What are inodes?

Inodes store metadata about files.

πŸ‘‰ Problem:

Disk shows free space But system says:

No space left on device

πŸ‘‰ Cause: Too many small files.

This is very common in:

  • log systems
  • microservices
  • temp file-heavy apps

6. Deleted Files Still Using Space

lsof | grep deleted

πŸ‘‰ Happens when:

file is deleted but process is still using it

So disk space is NOT freed.

Bonus Tool: ncdu (Best for Beginners)

sudo apt install ncdu   # Ubuntu/Debian
sudo dnf install ncdu   # Fedora/RHEL

Run:

ncdu /

Why it’s powerful:

  • interactive UI
  • easy navigation
  • visual disk breakdown

πŸ‘‰ Widely used by DevOps engineers for fast debugging

Basic Cleanup Tips

  • Remove old logs carefully
  • delete unused backups
  • Clear package cache when needed
  • Always verify before using rm -rf

⚠️ Common Beginner mistakes

  • Disk shows free space but system says full β†’ Check inodes (df -i)
  • using rm -rf without checking size
  • ignoring /var/log growth

Simple Mental Model

Think of disk like a room:

/home β†’ personal items /var β†’ messy logs piling up /usr β†’ installed apps /tmp β†’ temporary trash

πŸ‘‰ When room is full β†’ system slows down

Summary

In this guide you learned:

  • df -h β†’ Overall disk usage
  • du -sh β†’ Folder size
  • find β†’ Locate large files
  • df -i β†’ Check inodes
  • lsof | grep deleted β†’ Find deleted open files
  • ncdu β†’ Interactive disk usage analyzer

Why This Matters

Disk issues are one of the most common production failures in:

DevOps systems cloud servers databases CI/CD pipelines

πŸ‘‰ Knowing this = real-world Linux skill

Next Post: Linux Networking Basics for Beginners,(ping, curl, ip, ss, etc.)

Question for You

Have you ever faced a server where disk was full but you couldn’t find why?

That’s usually inode or deleted file issues β€” I’ll show debugging tricks in Part 7.

Discussion in the ATmosphere

Loading comments...