Get Disk Space Usage With NCDU

Kernel, Main, Utilities & Applications, Miscellaneous Devices.
edr
Posts: 104
Joined: Mon Jan 04, 2021 3:35 am
Has thanked: 34 times
Been thanked: 23 times

Get Disk Space Usage With NCDU

Unread post by edr »

A utility I use on Linux servers and my Macs. The precompiled ARM binary runs great on MiSTer.

https://dev.yorhel.nl/ncdu
https://dev.yorhel.nl/download/ncdu-2.1 ... arm.tar.gz

Untar and move `ncdu` to /usr/bin

I normally run it with:

Code: Select all

cd /
ncdu --color dark
U-D-L-R arrows to navigate into directories for subdir disk usage details

Careful with the 'd' key - it will delete the currently selected item (after confirmation prompt)
Attachments
Screenshot of ncdu on a MiSTer
Screenshot of ncdu on a MiSTer
ncdu v2.jpg (96.16 KiB) Viewed 9133 times
User avatar
mrchrister
Posts: 231
Joined: Tue Mar 30, 2021 6:23 pm
Location: Canada
Has thanked: 16 times
Been thanked: 79 times

Re: Get Disk Space Usage With NCDU

Unread post by mrchrister »

Great thanks for the tip.

For people needing step by step

ssh into your Mister

Code: Select all

wget https://dev.yorhel.nl/download/ncdu-2.0-linux-arm.tar.gz
tar -xf ncdu-2.0-linux-arm.tar.gz
chmod +x ncdu
cp ncdu /usr/bin/
cd /media/fat
then just type ncdu

This shows you how much space every directory takes up, super useful tool!
edr
Posts: 104
Joined: Mon Jan 04, 2021 3:35 am
Has thanked: 34 times
Been thanked: 23 times

Re: Get Disk Space Usage With NCDU

Unread post by edr »

Latest version now available is v2.1.2:
https://dev.yorhel.nl/download/ncdu-2.1 ... arm.tar.gz

And you can always check for the latest ARM version available at the homepage https://dev.yorhel.nl/ncdu
User avatar
Natrox
Scripting Wizard
Posts: 36
Joined: Thu Aug 04, 2022 2:05 pm
Has thanked: 8 times
Been thanked: 73 times

Re: Get Disk Space Usage With NCDU

Unread post by Natrox »

Nice tool! i had not heard of it before so I will go ahead and install it on my servers.

It's also available via Entware if you've got that installed on the MiSTer.

Alternatively, you can also do this yourself by running

Code: Select all

du -sh <folder>
Though.. it will not provide you with a nice interface, and you would have to script a little thingy to get a nice sorted list.
edr
Posts: 104
Joined: Mon Jan 04, 2021 3:35 am
Has thanked: 34 times
Been thanked: 23 times

Re: Get Disk Space Usage With NCDU

Unread post by edr »

Thanks for the Entware mention - will have to check it out sometime. I have heard of some of the projects that use it (OpenWRT and others). Entware currently provides a build script for ncdu v1 (1.17), not the newer ncdu v2 rewrite:

https://github.com/Entware/entware-pack ... u/Makefile

The newer v2 ncdu requires the obscure (for now?) zig build tool, which almost nobody uses and isn't generally provided by distros.

For reference, the change from ncdu v1 to v2 is documented here:
https://dev.yorhel.nl/doc/ncdu2

(quick summary)
  • "It (v1) has always been a bit of a memory hog"
  • "Ncdu 1.x does not handle hard link counting very efficiently and can ... get stuck"
  • "Another hard link-related problem" - related to disk usage info for multiple hardlinks to the same file
edr
Posts: 104
Joined: Mon Jan 04, 2021 3:35 am
Has thanked: 34 times
Been thanked: 23 times

Re: Get Disk Space Usage With NCDU

Unread post by edr »

And two other similar utilities which are faster at scanning than NCDU because they use multiple CPU cores:

GDU
https://github.com/dundee/gdu/releases
(grab the latest gdu_linux_armv7l.tgz release)

Untar the download and move/rename the binary to /usr/bin/gdu

Scan entire root path:

Code: Select all

gdu /
DUA-CLI
https://github.com/Byron/dua-cli/releases
(grab the latest dua-<version>-arm-unknown-linux-gnueabihf.tar.gz)

Untar the download and move/rename the binary to /usr/bin/dua

Scan entire root path (interactive mode):

Code: Select all

dua i /
Post Reply