Remote backups, reading from and writing to the same file

Hans Nieser h.nieser at
Thu Jan 12 15:25:12 PST 2006

Hi list,

For a while I have been doing remote backups from my little server at home 
(which hosts some personal websites and also serves as my testing 
webserver) by tarring everything I wanted to be backed up and piping it to 
another machine on my network with nc(1), for example:

On the recieving machine: nc -l 10000 > backup-`date +%Y-%m-%d`.tar.gz

On my server: tar -c -z --exclude /mnt* -f - / | nc -w 5 -o aphax 10000

(Some excludes for tar(1) are left out for simplicity's sake)

Among the things being backed up are my mysql database tables. This made 
me wonder wether the backup could possibly get borked when mysql writes to 
any of the mysql tables while tar is reading from them.

Do I really have to use MySQL's tools to do a proper SQL dump or stop 
MySQL (and any other services that may write to files included in my 
backup) before doing a backup? Do any of the more involved remote-backup 
solutions have ways of working around this? Or is it simply not possible 
to write to a file while it is being read?

More information about the freebsd-questions mailing list