Though this blog belongs to me, it doesn’t live with me. www.geofffox.com resides on a computer somewhere in the suburbs west of Philadelphia. I rent a tiny sliver of the server which is shared with countless others.
I pay the hosting company to handle the operating system and play traffic cop if one of the tenants uses more than his fair share of the resources. I handle the rest, including the code that runs my site.
About two weeks ago the server stopped allowing me to upload new files.
I poked around and found that though I have unlimited storage space (I’m using around 10 Gb of storage) there is a limit to the number of individual files. Sneaky.
I am allowed 262,144 files. That should be plenty. Unfortunately a quick check showed I was at the limit.
In a case like this there are a few go-to geeks I lean on. Not this time. This was going to be my challenge!
My server is headless, meaning there is no pretty graphical screen like you see on your computer. My only means of communication is through a terminal program.
Think Matthew Broderick in War Games!
This is where Google is indispensable as a tech support tool. A half dozen keywords hinting at what I wanted went in, a site with exactly the code I needed came out!
du ~/*|sort -n
Those characters commanded my server to count the number of files in each of its directories, then list them starting with the directory containing the most files.
Within seconds I found the problem. A caching plug-in, a tiny program to make this website faster for you, had gone nuts! It had spawned hundreds of thousands of files and never cleaned up after itself.
Two minutes later after an uninstall/reinstall I was 184,783 files short of a full load. Problem solved… at least for now.