Oh no! Those mysqldump files are taking up 95% of the volume!

Yeah, so it happens. Just remember this: gzip is your best friend.

My buddy shoots me an e-mail to say he’s mounted the new NAS for my new highly available WordPress environment, but noticed the existing data volume (which is on the SAN) is at 95% capacity.

A few “du -hs” commands later I’ve narrowed it down to the directory where I store the daily mysqldump files (because I don’t trust enteprise backups, never have).

First thing to do is to get that down to manageable size, so I run gzip against every file with the tell-tale .sql extention:

find . -name "*.sql" -type f -exec gzip {} \;

Next, I modify my daily backup script (which can also be run by my developers off-schedule through a webmin front-end I wrote for them) to add the following line:

system("gzip $dumpPath/$dumpName");

Script is written in perl, and I’ve found that the system pragma is more reliable that backticks.

Nice thing about this is that all my permission setting happens above the gzip line so I don’t have to do it again.

This entry was posted in System Administration on by .

About phil

My name is Phil Lembo. In my day job I’m an enterprise IT architect for a leading distribution and services company. The rest of my time I try to maintain a semi-normal family life in the suburbs of Raleigh, NC. E-mail me at philipATlembobrothersDOTcom. The opinions expressed here are entirely my own and not those of my employers, past, present or future (except where I quote others, who will need to accept responsibility for their own rants).