How I Caught Node-RED Eating My Disk with ncdu

Ever had your server suddenly scream:

No space left on device

Yeah, me too. And it wasn’t ransomware, it wasn’t a virus — it was my Node-RED logs quietly ballooning into gigabytes of digital fat.

I could’ve gone into panic mode. Instead, I reached for my favorite weapon: ncdu.


Meet ncdu: The Disk Usage Detective 🕵️‍♂️

ncdu stands for NCurses Disk Usage. It’s basically du -sh on steroids, with a super nice terminal UI.

Instead of scrolling through endless du output, ncdu lets you navigate your filesystem like a hacker movie — except you actually find the problem.

Install it (on Debian/Ubuntu):

sudo apt install ncdu

Then run it at root:

sudo ncdu /

The Hunt: Where Did My Space Go?

The first time I ran it, the culprit was obvious:

  20.0 GiB [##########] /var/lib/docker
   5.2 GiB [##        ] /home
   1.1 GiB [          ] /usr

Inside /var/lib/docker, I drilled down until I saw this monster:

  18.7 GiB [##########] /containers
   └── <container-id>-json.log

One log file. Almost 20 GB. My server wasn’t dying of complexity — it was dying of logs.


The Quick Fix

Once you know the file, you can trim it down instantly:

sudo truncate -s 0 /var/lib/docker/containers/<container-id>/<container-id>-json.log

Disk space back. Server happy. Me breathing again.


The Permanent Fix

Logs will grow back unless you fix the root cause:

  1. Enable Docker log rotation in docker-compose.yml: logging: driver: "json-file" options: max-size: "50m" max-file: "5"
  2. Clean up Node-RED Debug nodes — don’t log entire JSON payloads forever.
  3. Use ncdu regularly to patrol your disk.

Why I Love ncdu

  • It’s blazing fast (scans huge disks in seconds).
  • It shows exactly where your space is going.
  • It makes “WTF is eating my disk?” a 5-minute problem, not a 5-hour nightmare.

Final Thoughts

When my Node-RED logs tried to sink my server, ncdu was the detective that cracked the case.

So next time you see “disk full”, don’t panic. Just grab ncdu, point it at /, and let it expose the culprits.

Your server will thank you.


👉 Pro tip: Run ncdu as part of your monthly maintenance ritual. Think of it like brushing your teeth — skip it, and you’ll regret it later.

Related: The Day Node-RED Ate My Disk (and How I Tamed It).

Related: The CVE That Wasn’t: Microsoft’s Azure Vulnerability Rejection and t.


Discover more from Susiloharjo

Subscribe to get the latest posts sent to your email.

Discover more from Susiloharjo

Subscribe now to keep reading and get access to the full archive.

Continue reading