Ever waited on a long running ‘du -sh’?
Then make way for ncdu
-
Install ncdu
$ sudo apt-get install ncdu
-
Install a cron to index whatever is it that you monitor for disk usage - I use it to check disk hoggers in our graphite metrics pipeline
$ crontab -e # replace $target_dir by your dir # change cron frequency as per need 0 * * * * cd $target_dir && flock -n /tmp/ncdu.lock ncdu -o /var/tmp/ncdu.out
See that nifty flock trick? That is used to see to it that no more than one ncdu processes are running.
You might also want to gzip the file in case you are indexing a huge setup. From the ncdu man page:
ncdu -1xo- / | gzip > export.gz
-
The next time you want to check who is eating up disk space, just do
$ ncdu -f /var/tmp/ncdu.out
or in the case of the gzipped version
$ zcat export.gz | ncdu -f-
-
Check out the ncdu man page for more usage options.