I ran: rsync -Pva --exclude '*.gz' / <destination> For hours, strace has been scrolling: lstat64("<file>.gz", {st_mode=S_IFREG|0644, st_size=74, ...}) = 0 lstat64("<file>.gz", {st_mode=S_IFREG|0644, st_size=419, ...}) = 0 lstat64("<file>.gz", {st_mode=S_IFREG|0644, st_size=449, ...}) = 0 lstat64("<file>.gz", {st_mode=S_IFREG|0644, st_size=408, ...}) = 0 lstat64("<file>.gz", {st_mode=S_IFREG|0644, st_size=75, ...}) = 0 lstat64("<file>.gz", {st_mode=S_IFREG|0644, st_size=579, ...}) = 0 lstat64("<file>.gz", {st_mode=S_IFREG|0644, st_size=339, ...}) = 0 Seems like this statting of files which match the --exclude pattern could be skipped, saving a lot of time in some cases? I'm using rsync version 3.0.7. BasketCase in IRC reproduced this with v3.1.0.
A useful workaround would be something like: find / | grep -v 'gz$' > filelist.txt rsync -Pva --files-from=filelist.txt / <destination> Also, don't rsync /proc/kcore :/
Rsync wants to know if it is a file or a directory before applying the exclude rules, or it wouldn't have enough information for dir-only exclude rules. It might be possible to make the stat call lazy, where the first dir-only rule to match the name checks if the file-type is known, and does a stat if it is not. However, that might over complicate things. I'm marking this as an enhancement request.