Major rsync issue - overwriting files!!!
njgriffiths at gmail.com
Fri Mar 28 07:36:26 GMT 2008
I'm having a MAJOR issue with an rsync backup script that is actually
OVERWRITING the files that it should be backing up!
The thing is, the same script (with different source/destination
variables) runs FLAWLESSLY on another file server!
2 OS X client computers running 10.4.11 (1 intel, 1 PPC). both are
running rsync v2.6.3.
rsync is backing up from one firewire HD(afp share) to another,
dedicated backup HD (same situation on both machines.
on the PPC server, rsync runs fine. rotates, backs up, links, logs, etc.
on the intel server, rsync constantly attempts to overwrite the source
files (& has succeeded!), with empty directories. it simpply deleted
the source directory. once it overwrote it with old files from a
2 things i can't understand: A) --delete is NOT being used as an option.
B) the script is identical on both, the only differences being the
source & destination variables - yet they behave completely differently.
Also, on the intel, (which doesn't backup but destroys) the --dry-run
(or -n) option has NO effect - it doesn't dry-run - that's how i lost a
day's data. Also, some of the variable paths are changed by rsycn (tries
to add /Users/admin or some other such location to the beginning of the
path (--link-dest variable, for instance)
the script, in it's entirety is below. Please HELP!!!!
### Properties ###
### rsync options ###
OPTS="-Eapztc --links --ignore-errors --exclude-from=$EXCLUDES
### Sanity Check ###
echo >> $LOG
echo "*******" >> $LOG
echo `date` >> $LOG
echo "Source is "$SRC_DIR >> $LOG
echo "Backing up to ""$BAK_PATH"/Current>> $LOG
echo "rsync is linking to " $LINK_DEST >> $LOG
echo >> $LOG
### Script Action ###
# Make sure directories exist as needed
[ -d "$BAK_PATH"/Weekly ] || mkdir "$BAK_PATH"/Weekly
[ -d "$BAK_PATH"/Daily/PreviousBackup4 ] || mkdir -pm 750
[ -d "$BAK_PATH"/Daily/PreviousBackup3 ] || mkdir -pm 750
[ -d "$BAK_PATH"/Daily/PreviousBackup2 ] || mkdir -pm 750
[ -d "$BAK_PATH"/Daily/PreviousBackup1 ] || mkdir -pm 750
# Rotate PreviousBackups
rm -rf "$BAK_PATH"/Weekly >> $LOG
mv -v "$BAK_PATH"/Daily/PreviousBackup4 "$BAK_PATH"/Weekly >> $LOG
mv -v "$BAK_PATH"/Daily/PreviousBackup3
"$BAK_PATH"/Daily/PreviousBackup4 >> $LOG
mv -v "$BAK_PATH"/Daily/PreviousBackup2
"$BAK_PATH"/Daily/PreviousBackup3 >> $LOG
mv -v "$BAK_PATH"/Daily/PreviousBackup1
"$BAK_PATH"/Daily/PreviousBackup2 >> $LOG
mv -v "$BAK_PATH"/Current/ "$BAK_PATH"/Daily/PreviousBackup1 >> $LOG
mkdir -pm 750 "$BAK_PATH"/Current >> $LOG
# Run backup
rsync --dry-run --verbose --stats $OPTS $SRC_DIR "$BAK_PATH"/Current/
# rsync $OPTS $SRC_DIR "$BAK_PATH"/Current/ >> $LOG
More information about the rsync