Take the tour ×

If I use the command

rsync -av / /media/backup

Is /media/back included in the / filesystem? Would that cause some kind of repeating loop causing rsync to attempt to copy /media/backup to itself?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

You need to --exclude it.

sudo rsync -a --exclude=/media/backup  /  /media/backup

You may not need the delete option, but I've included it and some others below, in case you do. Note that -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.
share|improve this answer
Thanks for you help! –  dedwarmo Feb 10 at 16:42
add comment

Your Answer


