excluding based on filesystem?

Danny Sauer rsync at danny.teleologic.net
Wed Jan 19 16:44:42 GMT 2005


I'm using rsync as part of a system to create nightly snapshots of
several servers, much like several people are appearently doing.
However, I have a bit of a problem with things that I don't want
backed up.  On most of the systems, things like devfs, procfs, sysfs,
etc don't need backed up.  In addition, I have directories from one
server NFS mounted on several of the other servers - specifically
/home, among others.

My backup scheme is currently that the backup server initiates the
connection, and pulls the current state.  As I'm already doing this
over ssh, one possible solution is to have my script ssh in to the
remote machine, parse the output of `mount`, and generate an include
or exclude list from that.  However, from reading the way the
inc/exclude lists work, if someone happens to have made a directory
named dev, for example, then it'll be excluded from the backups, since
the list appears to be reapplied at each deeper stage in the directory
traversal.

Potentially, I could change the backup structure so that I back up
each individual filesystem into a separate directory, and use "rsync
-x" for each mountpoint.  That gives me an ugly backup tree, though.
My whole point is that I want a complete copy of each server that can
easily be restored to an arbitrary machine.

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.  Alternatively, it'd be great if I
could specify a command line argument that listed just the fstypes to
include (or exclude).

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?  This is all on an internal network, so I can
reasonably trust IP-based access controls to provide adequate security
- though I really would prefer to stick with server-pull rather than
client-push for the backups.

Thanks.
--Danny


More information about the rsync mailing list