# -a : all files, with permissions, etc..
# -x : stay on one file system
# -H : preserve hard links (not included with -a)
# -A : preserve ACLs/permissions (not included with -a)
# -W : copy files whole (w/o delta-xfer algorithm) - usually faster
# -X : preserve extended attributes (not included with -a)
# -S : handle sparse files efficiently
# --numeric-ids : avoid mapping uid/gid values by user/group name
# --info=progress2 : overall progress, instead for individual files, useful for large transfers
# --delete : delete extraneous files from dest dir(s)
sudo rsync -axHAWXS --numeric-ids --info=progress2 $SOURCE_DIR/ $TARGET_DIR --delete
To preserve the target ownership:
sudo rsync -axHAWXS --numeric-ids --no-owner --no-group --info=progress2 $SOURCE_DIR/ $TARGET_DIR --delete
Make sure to not include source directory in target path and also beware of trailing slashes.
rsync -avhW --delete --times --no-compress --progress --exclude=Cache $SOURCE_DIR $TARGET_DIR/