{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreieda4gbl6jryo4xu2oes35qldkdhuso4j6dijgg3e53ltetpjiqt4",
    "uri": "at://did:plc:25rdn5elo5izoxrmtis34zuk/app.bsky.feed.post/3mohf6ituptm2"
  },
  "coverImage": {
    "$type": "blob",
    "ref": {
      "$link": "bafkreiapqgri2z5i77n5sgfpbd7lhwrijsypl4wt4fyifvijajntokaymu"
    },
    "mimeType": "image/webp",
    "size": 55648
  },
  "path": "/sreekanth_kuruba_91721e5d/linux-disk-usage-explained-simply-46l2",
  "publishedAt": "2026-06-17T03:00:00.000Z",
  "site": "https://dev.to",
  "tags": [
    "linux",
    "devops",
    "beginners",
    "sysadmin"
  ],
  "textContent": "One of the fastest ways to break a Linux system is this:\n\n❌ Running out of disk space\n\nWhen disk fills up:\n\napps crash\nlogs stop writing\ndeployments fail\nservers become unstable\n\nπŸ‘‰ That’s why disk usage monitoring is critical in Linux and DevOps.\n\nLet’s simplify it.\n\n##  Disk Usage Basics (You Must Know This First)\n\n**What is Storage in Linux?**\n\nStorage is where Linux keeps:\n\n  * Files\n  * Applications\n  * Logs\n  * Databases\n\n\n\nExamples:\n\n  * HDD\n  * SSD\n  * Cloud volumes (AWS, etc.)\n\n\n\nIf storage becomes full:\n\n  * Applications may crash\n  * Logs may stop writing\n  * System can become unstable\n\n\n\nLinux uses storage through filesystems.\n\n###  What is a Filesystem?\n\nA filesystem is how Linux organizes storage.\n\nExamples:\n\n  * ext4\n  * xfs\n\n\n\nLinux mounts filesystems into directories like:\n\n  * `/`\n  * `/home`\n  * `/var`\n\n\n\n###  File Size vs Disk Usage\n\n  * **File size** β†’ Size of a single file\n  * **Disk usage** β†’ Total space consumed by files and directories\n\n\n\nCommands:\n\n  * `ls -lh` β†’ Check file size\n  * `du -sh` β†’ Check directory disk usage\n\n\n\n###  What is Mounting?\n\nLinux attaches storage devices to directories using a process called mounting.\n\nExamples:\n\n  * `/` β†’ Main filesystem\n  * `/home` β†’ User files\n  * `/var` β†’ Logs and application data\n\n\n\nThis is why `df -h` shows a **Mounted on** column.\n\n###  1. Check Overall Disk Usage with `df`\n\n\n    df -h\n\n\n**Example Output:**\n\n\n\n    Filesystem      Size  Used  Avail  Use%  Mounted on\n    /dev/sda1        50G   32G   18G   65%   /\n\n\n**Meaning:**\n\n  * Size β†’ Total disk\n  * Used β†’ used space\n  * Avail β†’ Free space\n  * Use% β†’ usage percentage\n  * Mounted on β†’ where disk is attached\n\n\n\nπŸ‘‰ First command to run when server behaves weirdly.\n\n###  2. Check Folder and Directory Size with `du`\n\n\n    du -sh /home\n    du -sh /var/log\n\n\n  * `-s` β†’ Summary (total size only)\n  * `-h` β†’ Human readable (KB, MB, GB)\n\n\n\nπŸ‘‰ Used to find which folder is consuming space\n\n###  3. Find Large Files in the System\n\n\n    find / -type f -size +100M 2>/dev/null\n    find / -type f -size +500M 2>/dev/null\n\n\n⚠️ Can take time on large systems.\n\nπŸ‘‰ Common use:\n\nlarge logs\nbackups\nunused media files\n\n###  4. Find Biggest Directories (Very Important)\n\n\n    du -sh /* 2>/dev/null | sort -hr | head -n 10\n\n\nπŸ‘‰ Shows top 10 largest directories\n\nThis is one of the most used DevOps troubleshooting commands.\n\n###  5. Disk Full but Space Looks Free? (INODES)\n\n\n    df -i\n\n\n**What are inodes?**\n\nInodes store metadata about files.\n\nπŸ‘‰ Problem:\n\nDisk shows free space\nBut system says:\n\n\n\n    No space left on device\n\n\nπŸ‘‰ Cause:\nToo many small files.\n\nThis is very common in:\n\n  * log systems\n  * microservices\n  * temp file-heavy apps\n\n\n\n###  6. Deleted Files Still Using Space\n\n\n    lsof | grep deleted\n\n\nπŸ‘‰ Happens when:\n\nfile is deleted\nbut process is still using it\n\nSo disk space is NOT freed.\n\n###  Bonus Tool: `ncdu` (Best for Beginners)\n\n\n    sudo apt install ncdu   # Ubuntu/Debian\n    sudo dnf install ncdu   # Fedora/RHEL\n\n\nRun:\n\n\n\n    ncdu /\n\n\nWhy it’s powerful:\n\n  * interactive UI\n  * easy navigation\n  * visual disk breakdown\n\n\n\nπŸ‘‰ Widely used by DevOps engineers for fast debugging\n\n**Basic Cleanup Tips**\n\n  * Remove old logs carefully\n  * delete unused backups\n  * Clear package cache when needed\n  * Always verify before using rm -rf\n\n\n\n###  ⚠️ Common Beginner mistakes\n\n  * Disk shows free space but system says full β†’ Check inodes (`df -i`)\n  * using rm -rf without checking size\n  * ignoring /var/log growth\n\n\n\n**Simple Mental Model**\n\nThink of disk like a room:\n\n/home β†’ personal items\n/var β†’ messy logs piling up\n/usr β†’ installed apps\n/tmp β†’ temporary trash\n\nπŸ‘‰ When room is full β†’ system slows down\n\n###  Summary\n\nIn this guide you learned:\n\n  * `df -h` β†’ Overall disk usage\n  * `du -sh` β†’ Folder size\n  * `find` β†’ Locate large files\n  * `df -i` β†’ Check inodes\n  * `lsof | grep deleted` β†’ Find deleted open files\n  * `ncdu` β†’ Interactive disk usage analyzer\n\n\n\n**Why This Matters**\n\nDisk issues are one of the most common production failures in:\n\nDevOps systems\ncloud servers\ndatabases\nCI/CD pipelines\n\nπŸ‘‰ Knowing this = real-world Linux skill\n\n**Next Post:**\nLinux Networking Basics for Beginners,(ping, curl, ip, ss, etc.)\n\n**Question for You**\n\nHave you ever faced a server where disk was full but you couldn’t find why?\n\nThat’s usually inode or deleted file issues β€” I’ll show debugging tricks in Part 7.",
  "title": "Linux Disk Usage Explained Simply"
}