Recently my web host informed my that my account was over-quota on disk space usage. Here’s how I tracked down and fixed the problem.
The web host’s tools were able to tell me that the space usage was in public_html and not mail or logs or something else. But where exactly? I SSHed into the account and gave the command
du -chd 1 /usr/www/users/$ACCOUNT_NAME. This showed me the space use of this directory and of each subdirectory, one level deep. I kept drilling down into the bloated subdirectory until I found the problem.
In this particular case the problem was a bloated Joomla page cache at /usr/www/users/$ACCOUNT_NAME/$JOOMLA_SITE/cache/page. While I could have cleaned it out manually with SSH, I opted to be conservative and use Joomla’s tools for this.
I logged in as an administrator to the ancient installation of Joomla 1.5. (Yes, I know it is obsolete and insecure and needs to be replaced stat. This is for a friend and I’ve been telling him that for years. His loss.) I went to Tools – Purged Expired Cache and did the deed. With nearly a gigabyte of cache files to delete it was no surprise that the operation repeatedly timed out and I had to repeatedly return and try again. Each time du assured me that the size of the page cache directory had shrunk, so I stuck with it. Persistence paid off, and once Purge Expired Cache did its work without timing out, I then went to Tools – Clean Cache and chose to clean everything. Once done, du assured me that the page cache was empty and public_html space usage was under control.