Você precisa --exclude
.
sudo rsync -a --exclude=/media/backup / /media/backup
Você pode não precisar da opção delete , mas eu a incluí e algumas outras abaixo, caso você queira. Observe que -rlptgoD
= -a
sudo rsync --dry-run -hv --progress --stats -rlptgoD \
--exclude=/media/backup \
--delete \
/ /media/backup
# A summary of most of the Options used above
# ===========================================
# --dry-run For tesing your command. Remove it
# when you are satisfied with the command.
# -hv Human Verbose
#
# -a, --archive Archive mode
# (-a == -rlptgoD # no -H,-A,-X)
# -r, --recursive Recurse into directories
# -l, --links Copy symlinks as symlinks
# -p, --perms This option causes the receiving rsync to set the destination
# permissions to be the same as the source permissions.
# -t, --times Preserve modification times
# -g, --group Preserve group
# -o, --owner Preserve owner (super-user only)
# -D Same as --devices --specials
# --devices Preserve device files (super-user only)
# --specials Preserve special files
#
# --delete Delete extraneous files from dest dirs
#
# 'PATTERN (for 'exclude')
# ’*’ matches any path component, but it stops at slashes.
# ’**’ to match anything, including slashes.