The PBX in a Flash machine at a client site sends me a daily Logwatch email (setup described here). At the bottom of that email are a few lines telling me how much disk space is in use. I also SNMP to monitor disk usage (described here).
Both of these tell me that disk usage is up to 75%. Looking back a few months, it was only 50%. What is using up so much space?
A quick Google search turned up this article: How Do I Find The Largest Top 10 Files and Directories On a Linux / UNIX / BSD? The very first command:
$ du -a /var | sort -n -r | head -n 10
showed me what I need to know:
11288832 /var 10821596 /var/spool 10821208 /var/spool/asterisk 10818532 /var/spool/asterisk/backup 10765244 /var/spool/asterisk/backup/Daily_00_30 149624 /var/lib 145476 /var/log 125308 /var/log/asterisk 123680 /var/log/asterisk/freepbx_dbug 88964 /var/www
A quick check of the /var/spool/asterisk/backup/Daily_00_30
directory confirms that my old daily backups are not being deleted. So it’s back to Linux Daily Delete Job with Logwatch to figure out what isn’t working.
Note If you want to see the whole file system (including mount points etc.), remove “var” from the command:
$ du -a / | sort -n -r | head -n 10
Update May 11, 2019
The above commands require GNU/sort. Searching more specifically for Ubuntu options, I came across this ServerFault answer suggesting ncdu. After a quick install
sudo apt install ncdu
I was quickly able to list the top system hogs with
sudo ncdu /
The simple GUI, running in Putty, let me drill down to /opt/bitnami/apps and explore which folders and files are biggest.