Keeping Your Linux VPS Disk Usage Low

The full title of this post is “Keeping your Linux VPS Disk Usage Low by managing your Tomcat Catalina.out file.”

The Backdrop

I’ve been a happy Linode VPS client for a year or so, paying $10 bucks a month for a 20GB Ubuntu Server. Everything was great until a couple of months ago when my sites were down because my MySQL and PostgreSQL database servers weren’t starting up. It was soon apparent that my 20GB disk was full.

There went my sweet $10 bucks a month plan for a VPS server. The Linode crew was very helpful and showed me how to bump up my plan to the 40GB partition, which went smoothly very relatively no downtime.

I’ve paid well over $100 bucks a month for Windows VPS hosting in the past, so it wasn’t a big deal for me to now be paying $20. With the additional storage I now had 2GBs RAM and 2 CPUs, so that was nice. Even though I now had 40GBs of disk storage, I began monitoring my disk usage regularly and I didn’t like what I was seeing. After 2 months of upgrading my plan I was pushing 65% usage of my 40GB partition, up 15% in 2 months from 50%. Something was going on, so I went to the obvious culprit, log files.

Hitting the Logs

First thing was to clear out old Apache and Tomcat log files. Everything older than 5 days was gone.

$ find * -mtime +5 -exec rm {} \;

That only reduced my disk use by a paltry 2 percent. Not the solution I had hoped. Then I saw this in my Tomcat LOGS folder.

To spare you a trip to the Google bytes-to-gigabytes converter, here’s the score.

Catalina.out be Gone

Catalina.out be gone, and now! The question is, what’s the best way to get rid of the file? It’s this:

$ echo "" > catalina.out

I forgot to take a screenshot of the VPS disk usage for you before I cleared catalina.out, but here are the totals afterward.

From 65% to 9%. Geez! I can downgrade to the $10 per month 20GB plan now, but I do like those 2GBs of RAM and 2 CPUs…

The moral of the story is that if you’re running Tomcat on a Linux VPS and don’t want to keep upgrading your plan, keep tabs on your Catalina.out file.