Pool Cleaning Tool

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
I recently needed to get back some space on one of my FreeNAS servers and had been tearing my hair out looking for an equivalent of WinDirStat or Disk Inventory X (or even a good way to run those over a mapped path, which does work, btw), but wasn't happy with leaving a process running across 2 boxes.

I found this in a linux forum and tried it out with great results:

ncdu, which stands for NCurses Disk Usage. Basically it's a collapsible version of du, with a basic command line user interface.
One thing worth noting is that it runs a bit slower than du on large amounts of data, so I'd recommend running it in a tmux session or using the command line options to first scan the directory and then view the results. Note the q option, it reduces the refresh rate from 1/10th of a second to 2 seconds, recommended for SSH connections.
Viewing total root space usage:
ncdu -xq / or add whatever base path you want instead of /

Generate results file and view later:
ncdu -1xqo- / | gzip > export.gz
# ...some time later:
zcat export.gz | ncdu -f-

It went very well on my millions of files, so I expect it should work for most folks' scenarios.

I then browsed the tree and used the "d" option to delete the bigger files I could find that I didn't want any more.
 
Last edited:
Top