Subject: Re: bug#14383: cp --one-file-system / will not copy whole root filesystem

From: Bob Proulx <[email-masked]>
Date: Fri, 10 May 2013 15:22:18 -0600

Andreas Schwab wrote:
> Pádraig Brady writes:
> > I suppose you could give the advice to ensure that all
> > mounts in a tree should be unmounted to ensure that
> > the base file system contents are copied.
> 
> The easiest way to uncover all over-mounted files of a filesystem is to
> bind-mount it somewhere else.

I could see creating a section in the documentation as a HOWTO on
copying filesystems from one place to another.  But I don't think cp
is the place to add code to do bind mounts so that an entire
filesystem is copied.  Also that is quite kernel specific behavior.
It would be a portability nightmare.

Also I think most users understand that the purpose of -x is to
prevent crossing filesystem boundaries.  Don't start walking
down nfs mounted filesystems.  Don't start walking down other mount
points at all.  And with it that means that anything that is shadowed
will also not be copied.  That has been the behavior since recursive
copies and -x were added to cp.

I know the suggestion wasn't to change the behavior of cp in this case
to actually copied the shadowed files but to document it somehow so
that the user is freshly aware of it.  Wake them up so that it is
fresh in their brain cache.

If cp -v is used does cp report skipping mount points?  That might be
the best place to note this happening.

Bob