Jean-Christophe Guillain
2011-Mar-15 14:41 UTC
rsync walks through excluded directories...
Hello all, In the INCLUDE/EXCLUDE PATTERN RULES section of the rsync man page I read that "the exclude patterns actually short-circuit the directory traversal stage when rsync finds the files to send" wich is actually the behaviour I expect. But it seems that rsync actually descend through all section of the hierarchy of some folders I excluded. The command I used : $ rsync -aH --del --ignore-errors --filter="- /lost+found/*" --filter="- /.snapshot/*" /data/orig_disks/vol-opt/ /data/bckp_disks/vol-opt/ The problem : $ lsof | grep rsync | grep snapshot rsync 1599 root 3r DIR 0,25 12288 12117707 /data/orig_disks/vol-opt/opt/.snapshot/some/directory/somefile rsync does not transfer files from this directory as expected, but it take hours to visit it... OS : Debian GNU/Linux Squeeze 6.0 amd64 rsync version : rsync version 3.0.7 protocol version 30 I don't know if it's a bug, an error in the man page, or just me :-) Thank you, jC -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20110315/cf0414e6/attachment.html>
On Tue, Mar 15, 2011 at 7:41 AM, Jean-Christophe Guillain < jc.guillain at gmail.com> wrote:> $ rsync -aH --del --ignore-errors --filter="- /lost+found/*" --filter="- > /.snapshot/*" /data/orig_disks/vol-opt/ /data/bckp_disks/vol-opt/ >Note that it is more efficient to leave off the trailing '*' so that the directory is excluded rather than the contents of the directory. With the '*', rsync has to list the dir's contents and see if it matches the exclude or not. However, that has the side effect of not creating (empty) lost+found and .snapshot dirs on the destination if they don't already exist. rsync 1599 root 3r DIR 0,25 12288> 12117707 /data/orig_disks/vol-opt/opt/.snapshot/some/directory/somefile >That .snaptshot doesn't match your excludes since it's down inside the opt subdir, not at the root of the transfer. If you want to exclude .snapshot dirs anywhere in the tree, leave off the leading slash. If you want to exclude that dir in particular, add the missing /opt prefix. ..wayne.. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20110315/0c9e3aec/attachment.html>