Option --link-dest creates unexplained subdirectory

Alan Louis Scheinine scheinin at crs4.it
Sat Sep 27 01:43:03 EST 2003


 The following backup script works fine for test cases but for
 doing a backup of 750 MB, the directory daily.1 has
 a subdirectory daily.0, that is, there is
 daily.1/daily.0
 daily.2/daily.1
 daily.3/daily.2
 The directory daily.0 has nothing strange, no unusual links
 at the top level neither hard or soft.
 Also, the original directory has not unusual links.
 All directories are in the same computer.
 Running on a dual-processor Xeon, Linux Red Hat 7.3, kernel 2.4.21
 The version is
 $ /usr/local/Backup/bin/rsync --version
 rsync  version 2.5.6  protocol version 26
 Copyright (C) 1996-2002 by Andrew Tridgell and others
 <http://rsync.samba.org/>
 Capabilities: 64-bit files, socketpairs, hard links, symlinks, batchfiles,
              IPv6, 64-bit system inums, 64-bit internal inums


#! /bin/bash
finalvalue=30
iter_value=$finalvalue
archiveroot="/tmp/scheinin/bow_backup"
origin="/tmp/scheinin/bow"
logfile="/tmp/scheinin/backup_log"
interval=daily

rm -rf ${archiveroot}/${interval}.finalvalue

# Move daily.19 to daily.20 ... move daily.0 to daily.1

while test $iter_value != 0
do
  oneless=$(($iter_value - 1))
  if test -d ${archiveroot}/${interval}.${oneless}
  then
    mv ${archiveroot}/${interval}.${oneless} 
${archiveroot}/${interval}.${iter_value}
  fi
  iter_value=$oneless
done

# Execute rsync using --link-dest option in order to save space

echo "`date`: starting rsync" >> $logfile
cmd="/usr/local/Backup/bin/rsync -a --delete \
 --link-dest=${archiveroot}/${interval}.1 \
 ${origin}/ \
 ${archiveroot}/${interval}.0/"
echo "Command: $cmd 2>> $logfile" >> $logfile
$cmd  2>> $logfile

if test $? != 0
then
   echo "`date`: rsync finished with error(s)" >> $logfile
   exit 1
else
   echo "`date`: rsync finished" >> $logfile
fi
exit 0





More information about the rsync mailing list