2026-01-11 - rsync and defaults

i really like rsync. there's sth brilliant in how it's (conceptually) simple and yet so powerful. there are however gotchas. recently i've noticed, when i sync data between some of my machines, there are certain files that are ~always re-synced (despite not being changed) as well as there are files that sync once, and then cause errors to sync after that.

to debug this it's worth using –itemize-changes that outputs a reason why a given file was synced. format is a bit cryptic, but after a moment with docs, it turned out that there's a bit of time offset (we're talking some tens of milliseconds, to be clear!) between source and target machines. this caused those “unfortunate” files to be always synced. the answer? use –times flag to rsync, so that it also copies creation / modification times from source. this way time offset between machines does not matter. that solved the 1st problem.

the second one is… odd. turns out that git does not give write permissions to object files in .git dir, as these are not expected to ever change after writing. fine locally, but a bit problematic when rsyncing repo, as there the file can change (e.g. resuming previous partial send). to fix this one –chmod=u+rw was added to rsync, so that remote copy has always R/W access for user at least. this allows to error-less sync things.

nice. these were quite some discoveries to be made. my only question – could we ask for a better defaults? the current ones just cause confusion…

btw: more rsync tips can be found on help_cmds repo, as usual.

blog/2026/01/11/2026-01-11_-_rsync_and_defaults.txt · Last modified: 2026/01/11 11:57 by basz
Back to top
Valid CSS Driven by DokuWiki Recent changes RSS feed Valid XHTML 1.0