Why does the mysql backup grow if a table is crashed?
I use this backup script on my debian squeeze server to create a backup of
all mysqltables:
#!/bin/sh
BACKUP_DIR=/var/backups/mysql/
DATE=$(date +%Y-%m-%d)
for i in /var/lib/mysql/*/; do
dbname=`basename "$i"`
mysqldump "$dbname" | gzip > $BACKUP_DIR/$dbname.sql.gz
done
# delete old backups older than 1 day
find $BACKUP_DIR -atime +1 -exec rm {} \;
Now sometimes if a table is "marked as crashed" (MyISAM), this backup
creates a huge file, several GB .
How can I prevent that?
I use that in combination with rsnapshot, that backups the BACKUP_DIR
again hourly but only incremental. And if there is suh an amok-backupfile
it will fill my complete harddrive after several hours.
I helped myself provisionally by adding these lines:
# delete backups > 2GB
find $BACKUP_DIR -size +2000M -exec rm {} \;
No comments:
Post a Comment