Stop du from lying to you about the size of your directory trees

Disk & Filesystem Management (Du/Df/Lsblk/Fstrim)

Stop du from lying to you about the size of your directory trees

🧩 The Challenge

Ever run du -sh and gotten a total that looks completely wrong compared to your partition usage? I once spent three hours hunting down a rogue log file because I didn’t realize mount points were getting skipped by default.

💡 The Fix

Use the mount flag to keep the utility contained within the single filesystem you are actually investigating. It saves you from accidentally summing up the size of every mounted network share or secondary drive attached to your path.

du -shx /path/to/directory

⚙️ Why It Works

Adding that x flag tells the tool to stay on one filesystem, which is the only way to get an accurate representation of what is actually consuming space on your local disk. It stops the recursive search from jumping into different mount points that aren’t relevant to your current search.

🚀 Pro-Tip: Pipe the output into sort -h to instantly find which subdirectories are the biggest offenders.

Linux Tips & Tricks | © ngelinux.com | 8/10/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted