rsync mirror solution: how to prevent accidental mirror deletion
Matt McCutchen
matt at mattmccutchen.net
Thu Jul 29 19:31:53 MDT 2010
On Thu, 2010-07-29 at 19:41 -0500, Rahul Nabar wrote:
> I used to maintain "mirror" backups of the /home dir on our
> production_server using rsync to a backup_server.
>
> The primary server had a rsyncd daemon running and the backup_server
> had this line in the crontab:
>
> 10 01 * * * rsync -av --delete root at production_server::home
> /production_server_home_bkup
>
> Things worked fine and whenever we tested backup_server it always had
> a faithful image of the production_server. Unfortunately, one day the
> RAID array on primary_server had a failure. As a result /home mount
> was lost temporarily. This happened over the weekend and by the time
> we got around to checking, the backup_server had a chance to run its
> cron job. This job merrily erased every file on the backup since it
> thought /home was now supposed to be empty when it synced the two.
If you can arrange for the source directory to appear nonexistent rather
than empty in the event of a disk failure, rsync would exit with code 23
instead of cleaning out the destination. One hacky way to do that would
be to put a symlink "me -> ." in the source directory and specify the
source as root at production_server::home/me/ .
--
Matt
More information about the rsync
mailing list