I’d been getting nervous, seeing the storage on our Hippie Hosting Co-op server filling up. We were over 80% full, with less than 18GB left until we were in serious trouble. So, I did some digging. I was getting ready to start deleting some of the bigger video files in my web hosting account, to make space. Turns out, that wasn’t necessary.
I use this to find directories that have lots of stuff in them:
du -Psckx * | sort -nr
For bonus marks, run that as root. For extra-special bonus marks, set it as an alias – I have this in my .bash_profile
on several servers:
alias dus='du -Psckx * | sort -nr'
Start where you suspect trouble (I started in the /var/www/vhosts
directory, thinking one of the stinking hippies was filling the place up with their free love. turns out, the hippies are only using just over 30GB of space, on a 100GB volume. no problem.) So, I moved to the root directory /
and tried it there. /var
was the biggest directory, so I moved into it and ran it from there. 2 big directories in it – /var/lib
and /var/www
. I’d already checked out /var/www
(where /var/www/vhosts
is), so I popped into /var/lib and ran it again. /var/lib/mysql
. Metric buttloads of files in there. Ruh roh.
I took a look, and saw LOTS of BIG mysql-bin
files in there. Some quick poking around the great MediaTemple documentation site, and I came across this piece on mysql binary logging. It’s used for replication and disaster recovery. We don’t replicate the server, and aren’t using the binary logs for disaster recovery. That’s what backups are for. I’ve had to disable binary logging on servers before, so it wasn’t a surprise. Well, I was surprised that it was enabled by default, but yeah…
The reporting command described on the MediaTemple documentation site dumped this:
MySQL binlog consuming 34.98 Gigabytes of disk space
35 GB. On a 100GB drive. When the next step up in server specs is about triple the monthly cost. Yeah… We don’t need binary logs that badly…
So I disabled binary logging, restarted the mysql server, and nuked the binary log files. Hey, presto! We’re now back under 50% of storage space used, with LOTS of room to grow. Awesome.
You’re a genius, fine detective work. So there’s enough room on Hippie Hosting for YouGroom now? 🙂
lots of room in the co-op. I’m hoping to avoid having to move up to the next tier of server specs, since it’s significantly more expensive. But we should be good for a couple of years now 🙂
This is teh awesome, and we can say so right here! So there’s one mondo MySQl log fo all us hippies? I’m trying to recall the other run away log I found a few years ago at NMC.
I know I’ve got a good bunch of weight on the server….
yeah. pesky binary logs… you’re one of the top server space users (I think right ahead of me), but the webserver hosting accounts are only taking 30% of the server’s drive. LOTS of room. no worries.