/errors/rsync/some-files-attrs-were-not-transferred-code-23
rsync error: some files/attrs were not transferred (see previous errors) (code 23)
- tool
- rsync
- exit code
- 23
- versions
- rsync 3.x
- os
- linux, macos
rsync error: some files/attrs were not transferred (see previous errors) (code 23) is a summary, not the error itself. rsync finished, but at least one file, or one attribute such as owner or modification time, could not be copied. The real errors are the lines starting with rsync: printed earlier in the output; the usual causes are files the user cannot read and destination filesystems that cannot store Unix owners, permissions or timestamps. Exit status 23 means "partial transfer due to error".
The full line also contains the source file and the rsync version, for example ... (code 23) at main.c(NNN) [sender=3.x.x]; those parts differ between builds.
Find the real error
rsync -a src/ dest/ 2>&1 | grep '^rsync:' | sort | uniq -c | sort -rn | head| Earlier message contains | Cause | Fix |
|---|---|---|
| send_files failed to open ... Permission denied (13) | Source file not readable | Run as a user who can read it, or --exclude it |
| failed to set times on | Destination cannot store mtimes (FAT, some SMB mounts) | --omit-dir-times, --modify-window=1, or drop -t |
| chown ... Operation not permitted | Not root, or filesystem without owners | --no-o --no-g, or run the receiver as root |
| failed to set permissions | FAT, exFAT, NTFS or SMB destination | --no-perms or use -rtv instead of -a |
| change_dir ... failed / link_stat ... failed: No such file or directory | Source path does not exist | Fix the path |
| File name too long | Destination name length limit | Rename the file or use another filesystem |
Copying to a USB disk or network share
-a means -rlptgoD: recursive, symlinks, permissions, times, group, owner, devices. Many of these cannot be stored on FAT, exFAT or SMB shares. Keep only what the destination supports:
rsync -rtv --modify-window=1 ~/Photos/ /media/usb/Photos/ # FAT/exFAT: 2-second timestamps
rsync -a --no-o --no-g --no-perms ~/project/ /mnt/share/project/In scripts
Code 23 can be acceptable for backups that skip a few unreadable files. Handle it explicitly instead of ignoring every error:
rsync -a /data/ /backup/data/
status=$?
if [ "$status" -ne 0 ] && [ "$status" -ne 23 ] && [ "$status" -ne 24 ]; then
echo "rsync failed with $status" >&2
exit "$status"
fiCode 24 is the related warning some files vanished before they could be transferred: files deleted while rsync was running, common for logs and caches.