[PATCH] One more -x to not traverse cyclic bind-mounts

Jeff Hansen jhansen at cardaccess-inc.com
Tue Jan 18 12:27:52 MST 2011


On 01/13/2011 06:14 PM, Wayne Davison wrote:
> On Thu, Jan 13, 2011 at 10:24 AM, Jeff Hansen 
> <jhansen at cardaccess-inc.com <mailto:jhansen at cardaccess-inc.com>> wrote:
>
>     This patch allows one to repeat the '-x' option a third time to
>     stop rsync from traversing potentially cyclic bind mounts that are
>     on the same filesystem.
>
>
> See the support/mnt-excl script for one way exclude all mounts 
> (including bind mounts) from an rsync.  The script also recommends an 
> awk command piped into an absolute-anchored exclude, but does get some 
> of the details wrong.  Here's a better explanation:
>
> awk '{print $2}' /proc/mounts | rsync -avf 'merge,/- -' /dir host:/dest/
>
> The above will get a list of all mount points on the system and use it 
> as an exclude list to prevent any mounts from being traversed. 
>  However, what it will not do is to protect the related mount points 
> on the receiving side from deletion unless you happen to be copying 
> into an exactly-the-same path on the destination.  If you want the 
> excluded directories to be protected on the receiving side, you're 
> better off using the mnt-excl script (which tweaks the excludes to be 
> relative to the transfer).
>
> ..wayne..
I hate to beat an (apparently) dead horse, but I've tested this patch on 
several systems and I would really appreciate it if this patch (or some 
variation of it) went into mainline.  It correctly syncs up whether the 
side with bind-mounts is local or remote.  Using scripts feels like an 
ugly work-around to the initial problem.

-Jeff

-- 

****Jeff Hansen

////////
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/rsync/attachments/20110118/202ceafd/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5622 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.samba.org/pipermail/rsync/attachments/20110118/202ceafd/attachment.bin>


More information about the rsync mailing list