[Bug 1455] Make -x skip a "bind" mount point to the same filesystem

samba-bugs at samba.org samba-bugs at samba.org
Thu Jun 10 22:10:34 GMT 2004


wayned at samba.org changed:

           What    |Removed                     |Added
           Severity|normal                      |enhancement
             Status|NEW                         |ASSIGNED
           Priority|P3                          |P4
            Summary|mount --bind is ignored by -|Make -x skip a "bind" mount
                   |x                           |point to the same filesystem

------- Additional Comments From wayned at samba.org  2004-06-10 15:10 -------
Since the bla/lib dir is on the same partition as bla, there is no way for the
current rsync algorithm to notice any difference (the stat() call shows no
change because the files dirs are actually on the same filesystem).  It might be
possible to do something like transform a mount list into an exclude list, but
only if it could be done portably (e.g. by using getfsent(), getmntent(), or
whatever is available).

In the meantime I've changed this bug to an enhancement request.

Your best bet for a quick fix is to use some explicit excludes.  One way is to
use a perl script to automatically create an exclude list from the /proc/mounts
file, like this one (name this "mntexcl"):

#!/usr/bin/perl -w
use strict;
my $start_dir = shift;
$start_dir =~ s#^([^/])#$ENV{'PWD'}/$1#;
my($prefix, $suffix) = $start_dir =~ m#^(.*/)([^/]*)$#;
open(IN, '/proc/mounts') or die $!;
while (<IN>) {
    $_ = (split)[1];
    next unless s#^\Q$prefix\E##o && $_ ne '';
    next if $suffix ne '' && !m#^\Q$suffix\E/#o;
    print "/$_\n";
close IN;

You could feed this into rsync like this (specifying the starting directory to
mntexcl so that it can properly trim the excludes):

mntexcl /www/ | rsync --exclude-from=- ... /www/ /backup/daily.0/www/

Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.

More information about the rsync mailing list