20130923 oh no those mysqldump files are taking up 95 of the volume - plembo/onemoretech GitHub Wiki

title: Oh no! Those mysqldump files are taking up 95% of the volume! link: https://onemoretech.wordpress.com/2013/09/23/oh-no-those-mysqldump-files-are-taking-up-95-of-the-volume/ author: phil2nc description: post_id: 6390 created: 2013/09/23 10:22:41 created_gmt: 2013/09/23 14:22:41 comment_status: closed post_name: oh-no-those-mysqldump-files-are-taking-up-95-of-the-volume status: publish post_type: post

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.

Copyright 2004-2019 Phil Lembo