-
Notifications
You must be signed in to change notification settings - Fork 463
Description
Hi,
I just figured out why my rsync backups keep ending with error / exitcode 23:
I have a path where 2 relative symlinks are present.
If replacing one of them by an absolute path the error is gone.
The problem is that I need the relative path to be kept in order for everything to keep working when the folder structure is mounted via SSHFS on a different client system than the one I use for the backup.
Some "silly" example to be able to reproduce the problem:
/var/www/html/A/KB/IT/FS/ext4/index.php
/var/www/html/A/KB/IT/OS/GNU+Linux/Debian/index.php
/var/www/html/A/KB/IT/OS/GNU+Linux/Debian/FS <=> ln -rs -T "/var/www/html/A/KB/IT/FS/" "FS"
/var/www/html/B/KB <=> ln -rs -T "/var/www/html/A/KB/" "KB"
In this example, /var/www/html/B/KB will add up to /var/www/html/A/KB/IT/OS/GNU+Linux/Debian/FS and create a situation while it is resolved properly by "Nemo" files manager from "Linux Mint" (to mention what I used to visually check if anything missing as said by 'rsync').
It would be great if 'rsync' could just copy the links as they are instead of interpreting them or trying to set time and other attributes when there is no target pointed by the said links.
Following are some real error messages for reference, in case my problem could be (I wish) just a configuration problem to perform the backup:
rsync: [generator] failed to set times on "/home/mint/backups/2025-12-30_@_00:31:42_UTC/var/www/html/pages/source/kb/it/os/linux/files_systems/fs": No such file or directory (2)
sent 1,328 bytes received 150,610 bytes 3,132.74 bytes/sec
total size is 1,365,006,134 speedup is 8,983.97
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1865) [generator=3.2.7]
Thanks for reading this and, eventually have a look at it for us all. :-)
Best regards,
H.P.
[edit 2025-12-30 @ 00h42 (UTC)]
P.S.
Following is what can be found in my bash script for the job:
#! /bin/bash
server_ipaddrv4='123.123.123.123'
user='user'
date_now="`date +%Y-%m-%d_@_%H:%M:%S_UTC`"
src="$user@$server_ipaddrv4:/var/www/html"
dst="/home/$USER/website/backups/$date_now"
## [Edit: 2026-01-12 @ 01h12 (UTC) = Comments section below added]
## 2025-12-30 @ 04h26 (UTC) by HP
## "Directory Tree" == Targeted SOURCE directory containing files, subdirectories and some symlinks
##
## NOTE: -var includes already '-l' which is the short form for '--links'
##
## --links ALL symlinks ARE KEPT AS THEY ARE (pointing outside or inside the directories tree) and Not changed at all.
## --safe-links REMOVES symlinks pointing outside the directories tree ONLY and keeps other symlinks pointing inside the directory tree.
## --munge-links KEEPS symlinks pointing outside the directories tree AND changed then to '/rsyncd-munged/<original_target_value>' /!\/!\/!\/!\
## --copy-unsafe-links REPLACES symlinks pointing outside the directories tree BY CONTENT pointed to ! =>> BIGGER final ARCHIVE file.
##
# rsync -e ssh -var -H --links "$src" "$dst/." ; # Exactly what's needed for SymLinks.
rsync -e ssh -var -H "$src" "$dst/." ; # Exactly what's needed for SymLinks.
# rsync -e ssh -var -Hl --safe-links "$src" "$dst/."
# rsync -e ssh -var -Hl --munge-links "$src" "$dst/."
# rsync -e ssh -var -l --munge-links "$src" "$dst/." ; # Exactly same as right above since NO hardlink in test data source
exitcode=$?
if [ $exitcode -eq 0 ]
then
cd "$dst/.."
ln -sf -T "$dst" "latest_server_backup -->"
else
mv "$dst" "${dst}_FAILED_"
fi
echo ""
read -p "Press [Enter] to continue..."
exit $exitcode
P.P.S.
My apologies for the subsequent edits, I was indeed more tired than I thought to be when I initiated this thread...