惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
博客园 - 聂微东
人人都是产品经理
人人都是产品经理
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园_首页
量子位
阮一峰的网络日志
阮一峰的网络日志
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hackread – Cybersecurity News, Data Breaches, AI and More
云风的 BLOG
云风的 BLOG
D
DataBreaches.Net
B
Blog
L
LangChain Blog
Apple Machine Learning Research
Apple Machine Learning Research
Vercel News
Vercel News
博客园 - 三生石上(FineUI控件)
爱范儿
爱范儿
Microsoft Azure Blog
Microsoft Azure Blog
IT之家
IT之家
aimingoo的专栏
aimingoo的专栏
B
Blog RSS Feed
H
Help Net Security
The Cloudflare Blog
U
Unit 42

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Linux Disk Usage Explained Simply
Sreekanth Kuruba · 2026-06-17 · via DEV Community

Sreekanth Kuruba

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.