[vox-tech] Tar, MySQL, and cron-ed backups

Marc Elliot Hall vox-tech@lists.lugod.org
Fri, 05 Dec 2003 11:43:54 -0800


Each night I run via cron a shell script to backup one of my Debian 
boxes, which has NFS-mounted partitions for the rest of my network.

The backup is supposed to do a full copy-to-tape of all the specified 
directories, including the NFS-mounted partitions.

However, I get a "tar: file changed as we read it" error on a couple of 
MySQL db files because they are in use during the backup. Locking the 
files during the backup is not an option because another automated 
process -- which really can't be rescheduled, either -- writes to them 
during the same window.

I could --exclude the files; but that would mean they don't get backed 
up properly (meaning automatically), which would be a Bad Thing.

So, if tar is saying the "file changed as we read it", does that mean 
that tar:
* skipped the file,
* made a copy of the version that existed when tar *started* the operation,
* made a copy of the version that existed when tar *finished* the 
operation, or
* some combination of these?

Why, look, someone with *precisely* the same question -- and no answer 
since April 2001:
http://mail.gnu.org/archive/html/help-gnu-utils/2001-04/msg00021.html

Somebody with a suggested workaround using mysqldump that doesn't quite 
work for me:
http://ben.milleare.com/archives/000016.html

Any other ideas?