Feature Request: Options to limit --one-file-system at the source or destination.

Matt McCutchen matt at mattmccutchen.net
Tue Jan 15 18:40:40 GMT 2008


On Tue, 2008-01-15 at 13:21 -0500, Hans Deragon wrote:
>   Currently, the --one-file-system applies to both the source and
>   destination and this is a problem.
> 
>   In my source, I have a symlink pointing to a directory on another
>   device which I would like to have copied.  I thus use
>   --copy-unsafe-links.
> 
>   I also use --delete.  This is dangerous because if there is a bug in
>   my script, I would not like the destination to become suddenly / and
>   deletion occurs on mounted network drives (granted, the machine would
>   be toast, but the damage would be limited to the machine; not the
>   corporate network).
> 
>   If I make use of --one-file-system, the symlink at the source gets
>   ignored.  So I need a --one-file-system option that applies only to
>   the destination, probably named something like
>   --one-file-system-at-destination.
> 
>   Could that be easily implemented?  The following two options would be
>   nice:
> 
>   --one-file-system-at-source
>     # Limit to one file system at the source.
> 
>   --one-file-system-at-destination
>     # Limit to one file system at the destination.

This is a good feature request and would be easy to implement.

However, if the source contains only a small, fixed set of
cross-filesystem symlinks that you want to follow, a quicker solution
would be to use --relative and provide for each such symlink an
additional source argument that reaches through it, starting a new
--one-file-system traversal at its target.  This approach also avoids
the need for --copy-unsafe-links.  For example, if you want to copy
~/src to ~/dest and have rsync follow a symlink ~/src/extrafiles
-> /tmp/extrafiles to obtain additional source files, you would run:

rsync -r --relative --one-file-system \
	~/src/./ ~/src/./extrafiles/ ~/dest/

Another approach is to use protect filters instead of --one-file-system
as a precaution against undesired deletions.

Matt



More information about the rsync mailing list