rsync error message

Charles Jones charles.jones at ciscolearning.org
Fri Dec 19 03:28:23 MST 2008


Robert Holtzman wrote:
> Tried rsync -av /home/username /media/disk for the first time. Every 
> thing appeared to go well but there was an error message at the end:
>
> rsync error: some files could not be transferred (code 23) at 
> main.c(977) [sender=2.6.9]
>
> Running "diff -r /home/holtzm /media/disk/home" returned nothing which 
> indicates they are identical. The question is what files could not be 
> transferred and is there a better way of checking?
>   
I think I used to see this error when there was a broken symlink on the 
filesystem. Rsync copies the invalid symlink so a diff will indeed look 
identical, however rsync tries to follow the broken symlink and cannot, 
which causes the error.

I found an old rsync script that I once used, which checked the return 
status and included a proper error message to log and send in an email alert

/usr/bin/rsync $RSYNCOPTIONS $SOURCEDIR/ $RSYNCUSER@$HOST:$DESTDIR/
# Check rsync error codes
RSYNC_ERROR=$?
if [ 0 -ne $RSYNC_ERROR ] ; then # rsync failed somehow...
     RSYNC_ERRMSG="Unknown Error...its not a documented one...Perhaps 
SunSpots?"
   if  [ 1 -eq $RSYNC_ERROR ] ; then
     RSYNC_ERRMSG="Syntax or Usage Error"
   elif [ 2 -eq $RSYNC_ERROR ] ; then
     RSYNC_ERRMSG="Protocol Incompatibility"
   elif [ 3 -eq $RSYNC_ERROR ] ; then
     RSYNC_ERRMSG="Error selecting input/output files or dirs"
   elif [ 4 -eq $RSYNC_ERROR ] ; then
     RSYNC_ERRMSG="Requested action supported by client but not server"
   elif [ 5 -eq $RSYNC_ERROR ] ; then
     RSYNC_ERRMSG="Error starting client-server protocol"
   elif [ 10 -eq $RSYNC_ERROR ] ; then
     RSYNC_ERRMSG="Error in socket I/O"
   elif [ 11 -eq $RSYNC_ERROR ] ; then
     RSYNC_ERRMSG="Error in file I/O"
   elif [ 12 -eq $RSYNC_ERROR ] ; then
     RSYNC_ERRMSG="Error in rsync protocol data stream (This is usually 
triggered by ssh-key problems or remote disk is full"
   elif [ 13 -eq $RSYNC_ERROR ] ; then
     RSYNC_ERRMSG="Error with program diagnostics"
   elif [ 14 -eq $RSYNC_ERROR ] ; then
     RSYNC_ERRMSG="Error in IPC code"
   elif [ 20 -eq $RSYNC_ERROR ] ; then
     RSYNC_ERRMSG="Received SIGUSR1 or SIGINT (HUP or killed)"
   elif [ 21 -eq $RSYNC_ERROR ] ; then
     RSYNC_ERRMSG="Some error returned by waitpid()"
   elif [ 22 -eq $RSYNC_ERROR ] ; then
     RSYNC_ERRMSG="Error allocating memory core buffers"
   elif [ 23 -eq $RSYNC_ERROR ] ; then
     RSYNC_ERRMSG="Partial transfer due to error"
   elif [ 24 -eq $RSYNC_ERROR ] ; then
     RSYNC_ERRMSG="Partial transfer due to vanished source files (they 
were deleted before/while transfer in progress)"
   elif [ 30 -eq $RSYNC_ERROR ] ; then
     RSYNC_ERRMSG="Timeout in data send/receive"
   fi
echo `date +"%d%b%Y %H:%M:%S"` "ERROR: rsync failed for $db xfer to 
$HOST with error: [$RSYNC_ERRMSG]" 1>&2 >>$logfile

-Charles


More information about the PLUG-discuss mailing list