excluding based on filesystem?

Wayne Davison wayned at samba.org
Wed Jan 19 21:26:02 GMT 2005


On Wed, Jan 19, 2005 at 10:44:42AM -0600, Danny Sauer wrote:
> So, what I'm looking for is possibly a way to make excludes relative
> to the root at the beginning of the operation - so that if I specify
> "rsync --exclude /dev host:/ /backup/host", only /dev on host is
> excluded, not /home/user/dev, etc.

That is precicely what already happens.  The only way it would exclude a
"dev" further down in the transfer is for you to have specified "dev"
instead of "/dev" -- the leading slash anchors the exclude at the base
of the transfer.

There is a script that can generate an exclude list for you based on
mount points.  One version is attached to bug #1455, but I just checked
in a slightly improved version into the "support" dir of the CVS source.
You can see it here:

    http://rsync.samba.org/ftp/unpacked/rsync/support/mnt-excl

It may not be quite what you want, but it would be easy to adapt its
directory-trimming algorithm to work with some other list of exclusions
other than the one taken from /proc/mounts.  Doing that would let you
create a file of exclusions with absolute paths and have the script
select and trim only the excludes that were relevant for a transfer from
the indicated source directory.

> Alternatively, is it possible to set up an rsync server on each of the
> machines to be backed up, with the server excluding portions of the
> directory tree?

Sure, that's easy.  See the "exclude" and "exclude from" directives
in the rsyncd.conf file.  These excludes are relative to the "path"
specified for the module, so they affect every transfer no matter what
subdir the user specifies for the source.  They make the files vanish
as far as the client is concerned, though, which affects --delete.

..wayne..


More information about the rsync mailing list