Rsync transfers entire files with different attributes only

I’m trying to rsync to a remote folder which already has the files. I’m pretty sure the contents are the same, as Syncthing has checked them before. After Syncthing I changed their permission, ownership and SELinux context. Now However the transfer is basically sending every file. Is this supposed to happen?

Literal data: 34,217,246,383 bytes
Matched data: 0 bytes

Wait, the attributes in destination files aren’t changed. But the destination was specified correctly as far as I can see… Is there a way to check that rsync sent the file to the right place?

rsync -a --info=progress2 ~/Music --stats
$ stat /mnt/usb1/Backup/Music/sources
Access: (0750/drwxr-x---)  Uid: ( 1000/  user)   Gid: (  975/   caddy)
Context: system_u:object_r:httpd_sys_content_t:s0
$ stat ~/Music/sources
Access: (0700/drwx------)  Uid: ( 1000/  user)   Gid: ( 1000/  user)

It depends on the options you pass (and the order that you pass them). You probably need to add --no-perms, --no-owner, --no-group, and --no-xattrs (for SELinux). (And maybe --no-times.)

Sorry I just updated the post. I used -a but the attributes weren’t changed, which is even weirder…

-a (archive mode) turns on all of those things. You’ll need to add the options I listed after -a to turn them back off (or use more fine-grained flags than -a to construct your command). Anyway, it’s all in the man page man rsync. :slightly_smiling_face:

I’m not sure what you are suggesting, did you mean “it is supposed to happen”? Ok I guess…
But still -a implies attributes will be synced which didn’t happen?

I guess I misunderstood your question. I had read it as saying that changing the attributes was causing the files to be resent and you didn’t want it to do that.

There might be a hint as to what is going on in the documentation for the --times flag:

–times, -t
This tells rsync to transfer modification times along with the files and update them on the remote system. Note that if this option is not used, the optimization that excludes files that have not been modified cannot be effective; in other words, a missing -t (or -a) will cause the next transfer to behave as if it used --ignore-times (-I), causing all files to be updated (though rsync’s delta-transfer algorithm will make the update fairly efficient if the files haven’t actually changed, you’re much better off using -t).


Skimming the man page, it looks like the --checksum flag might cause rsync to use hashes instead of modification times and file sizes to determine what needs to be transferred. You might give that option a try and see if it does what you want.

1 Like

Oh, rsync has a well-known issue where you have to add a trailing / to the source directory to avoid it duplicating the content in a subdirectory of the destination path on the second run. See the USAGE section of the man page for an explanation.

Edit: But to more directly answer your question, yes, rsync has --verbose and --dry-run flags that allow you to see what would be done by a given command without actually doing it.

1 Like

That’s reason. Oh dear I got a bunch of folders to clean…


–delete Delete files that don’t exist on the sending side