Background
Typically with rsync
you'll see warnings if either:
- the
rsync
server at the other end does not possess permissions to execute an action associated with the following:
- owner
- group
- permissions
- access times
- or the filesystem on the remote side does not support the same types of metadata as the sender (permissions, ownership, etc.)
These issues will manifest themselves through the rsync
client that's attempting to communicate with the rsync
server showing up as as messages like this when attempting to copy files/directories over to a receiver:
owner
rsync: chown "/mnt/music/The Fleetwood Mac/Trilogy - 2006/Trilogy - 2006 - CD 3/311_fleetwood_mac_-_eyes_of_the_world.mp3" failed: Operation not permitted (1)
group
rsync: chgrp "/mnt/music/The Fleetwood Mac Discography by Sketch/Trilogy - 2006/Trilogy - 2006 - CD 3/311_fleetwood_mac_-_eyes_of_the_world.mp3" failed: Operation not permitted (1)
permissions
rsync: failed to set permissions on "/mnt/music/The Fleetwood Mac Discography by Sketch/Trilogy - 2006/Trilogy - 2006 - CD 3": Operation not permitted (1)
In cases where the receiving side cannot perform these operations you can instruct rsync
to merely skip attempting to do them, realizing that the destination will not be strictly identical with the sender's metadata around the files. This will still create identical copies of the binary portions of the files and directories.
To tell rsync
not to worry about the metadata you can use the --no-OPTION
to disable any of these implied options.
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 prefixed 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).
So in our case we'll want to use something like this to disable things:
$ rsync -avz --no-o --no-g --no-perms <src> <dst>
Example
$ rsync -avz --delete --no-o --no-g --no-perms The\ Fleetwood\ Mac/ /mnt/music/The\ Fleetwood\ Mac/.
sending incremental file list
Trilogy - 2006/
Trilogy - 2006/Trilogy - 2006 - CD 3/
Trilogy - 2006/Trilogy - 2006 - CD 3/301_fleetwood_mac_-_love_in_store.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/302_fleetwood_mac_-_cant_go_back.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/303_fleetwood_mac_-_thats_alright.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/304_fleetwood_mac_-_book_of_love.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/305_fleetwood_mac_-_gypsy.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/306_fleetwood_mac_-_only_over_you.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/307_fleetwood_mac_-_empire_state.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/308_fleetwood_mac_-_straight_back.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/309_fleetwood_mac_-_hold_me.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/310_fleetwood_mac_-_oh_diane.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/311_fleetwood_mac_-_eyes_of_the_world.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/312_fleetwood_mac_-_wish_you_were_here.mp3
sent 61993245 bytes received 289 bytes 17712438.29 bytes/sec
total size is 2596551439 speedup is 41.88
Alternative
Another reason this is happening is because of the use of the -a
switch. -a
includes a family of switches:
-a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
Instead of using -a
you could use the individual switches and forgo having to use the --no-OPTION
's.
These are the individual options included with -a
-r, --recursive recurse into directories
-l, --links copy symlinks as symlinks
-p, --perms preserve permissions
-t, --times preserve modification times
-o, --owner preserve owner (super-user only)
-g, --group preserve group
-D same as --devices --specials
--devices preserve device files (super-user only)
--specials preserve special files
Doing things this way the above example would become this instead:
$ rsync -rltDvz --delete The\ Fleetwood\ Mac/ /mnt/music/The\ Fleetwood\ Mac/.
sending incremental file list
Trilogy - 2006/
Trilogy - 2006/Trilogy - 2006 - CD 3/
Trilogy - 2006/Trilogy - 2006 - CD 3/301_fleetwood_mac_-_love_in_store.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/302_fleetwood_mac_-_cant_go_back.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/303_fleetwood_mac_-_thats_alright.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/304_fleetwood_mac_-_book_of_love.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/305_fleetwood_mac_-_gypsy.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/306_fleetwood_mac_-_only_over_you.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/307_fleetwood_mac_-_empire_state.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/308_fleetwood_mac_-_straight_back.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/309_fleetwood_mac_-_hold_me.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/310_fleetwood_mac_-_oh_diane.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/311_fleetwood_mac_-_eyes_of_the_world.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/312_fleetwood_mac_-_wish_you_were_here.mp3
sent 61993245 bytes received 289 bytes 17712438.29 bytes/sec
total size is 2596551439 speedup is 41.88