Don't follow bind mounts?

Shachar Shemesh shachar at shemesh.biz
Thu May 16 13:33:25 MDT 2013


On 16/05/13 03:52, Carl Brewer wrote:
>
> Hello,
> The manual says that rsync treats bind mounts on UNIX (Linux) to the
> same filesystem as being on the same filesystem.
>
> I have a server with a pile of bind mounts to the same filesystem for
> some access control/ease of use for FTP users modifying websites. 
> This makes my backups using rsync messy!
>
> Is there any way to stop rsync from following bind mounts to the same
> filesystem?  Short of unmounting them all at backup time and
> remounting afterwards or explicitly excluding each one?
Rsync uses the device id to know whether it has crossed a mount
boundary. Since bind mounts have the same device ID, rsync does not know
it has reached one. Most other tools (tar) have the same problem.

My personal solution is to bind-mount the root of the file system to a
neutral location, and rsync from there. So if I have /dev/sda17 mounted
on /src/messy, with lots and lots of bind mounts (and other filesystems)
inside it, I do "mount --bind /srv/messy /tmp/backup", and then rsync
from /tmp/backup.

This also makes sure that I back up all directories hidden by other
mounts done later.

Shachar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/rsync/attachments/20130516/d1c358b5/attachment.html>


More information about the rsync mailing list