rsync ignore owner, group, time, and perms
I think you can use the -no-
options to rsync
to NOT copy the ownership or permissions of the files you're sync'ing.
Excerpt From rsync Man Page
--no-OPTION
You may turn off one or more implied options by prefixing the option
name with "no-". Not all options may be pre‐fixed with a "no-":
only options that are implied by other options (e.g. --no-D,
--no-perms) or have different defaults in various circumstances (e.g.
--no-whole-file, --no-blocking-io, --no-dirs). You may specify
either the short or the long option name after the "no-" prefix (e.g.
--no-R is the same as --no-relative).
For example: if you want to use -a (--archive) but don’t want -o
(--owner), instead of converting -a into -rlptgD, you could specify
-a --no-o (or -a --no-owner).
The order of the options is important: if you specify --no-r -a, the
-r option would end up being turned on, the opposite of -a
--no-r. Note also that the side-effects of the --files-from
option are NOT positional, as it affects the default state of several
options and slightly changes the meaning of -a (see the --files-from
option for more details).
Ownership & Permissions
Looking through the man page I believe you'd want to use something like this:
$ rsync -avz --no-perms --no-owner --no-group ...
To delete files that don't exist you can use the --delete
switch:
$ rsync -avz --no-perms --no-owner --no-group --delete ....
Timestamps
As for the timestamp I don't see a way to keep this without altering how you'd do the comparison of SOURCE vs. DEST files. You might want to tell rsync
to ignore timestamps using this switch:
-I, --ignore-times
Normally rsync will skip any files that are already the same size
and have the same modification timestamp. This option turns off this
"quick check" behavior, causing all files to be updated.
Update
For timestamps, --no-times
might do what you're looking for.
I think it´s easier to avoid the -a option
$ -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
and set only the options do you want.
If you like all options but not the modifications of user -o, group -g, time -t and permissions -p so you could subtract these four options from the archive equivalent.
$ -rlD
To delete the files on destination please use option --delete.
To your question: But I think all files will be checked - rsync can´t transfer/check only files that changed only by content.
I think what you are looking for is the option
rsync -r --size-only
from the man page:
--size-only
This modifies rsync’s "quick check" algorithm for finding files that need to be transferred,
changing it from the default of transferring files with either a changed size or a changed
last-modified time to just looking for files that have changed in size. This is useful when
starting to use rsync after using another mirroring system which may not preserve timestamps
exactly.
If you really want to delete files missing in the source dir use --delete