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

2013-05-10 Thread Pavel Machek
Hi!

On systems like linux, cp / -a --one-file-system (destination) will
not copy whole root filesystem. It is not cp's fault, but the
behaviour is quite surprising to the users, so maybe it would be worth
warning in man page?

Something like

   -x, --one-file-system
  stay on this file system

  Note that on systems that allow mounts over non-empty
  directories (like Linux), cp / -ax (destination) will
  not copy whole filesystem. In particular, content of
  /dev will not be usually copied, because distributions
  mount tmpfs over /dev.

[Ok, there's hopefully better wording...?]
Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html





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

2013-05-10 Thread Bob Proulx
severity 14383 wishlist
thanks

Pavel Machek wrote:
 On systems like linux, cp / -a --one-file-system (destination) will
 not copy whole root filesystem. It is not cp's fault, but the
 behaviour is quite surprising to the users, so maybe it would be worth
 warning in man page?
 
 Something like
 
-x, --one-file-system
   stay on this file system
 
 Note that on systems that allow mounts over non-empty
 directories (like Linux), cp / -ax (destination) will
 not copy whole filesystem. In particular, content of
 /dev will not be usually copied, because distributions
 mount tmpfs over /dev.
 
 [Ok, there's hopefully better wording...?]

But isn't that the entire purpose of -x?  To avoid copying files on
other file systems?

I am just not sure about having a description that is don't copy
files on other filesystems and then warning: does not copy files on
other filesystems.

I have never liked the wording of stay on this file system.  Usually
describing things in the positive, saying what it does, is best.  But
I always felt that with -x describing it in the negative, saying what
it does not do, would be better wording.

Bob





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

2013-05-10 Thread Pavel Machek
Hi!

 But isn't that the entire purpose of -x?  To avoid copying files on
 other file systems?
 
 I am just not sure about having a description that is don't copy
 files on other filesystems and then warning: does not copy files on
 other filesystems.
 
 I have never liked the wording of stay on this file system.  Usually
 describing things in the positive, saying what it does, is best.  But
 I always felt that with -x describing it in the negative, saying what
 it does not do, would be better wording.

No no, I'm saying that it will not copy data on *this* filesystem;
because other filesystem is mounted over those data.

Lets say you have this on your / (ext3):

/
/dev/foo

But your distro mounts devtmpfs over /dev, so /dev/foo is not visible,
and not copied :-(.

Not that cp can do much about that, but I tried to backup my /
filesystem, and that's exactly what happened.
 
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html





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

2013-05-10 Thread Pádraig Brady
On 05/10/2013 11:55 AM, Pavel Machek wrote:
 Hi!
 
 On systems like linux, cp / -a --one-file-system (destination) will
 not copy whole root filesystem. It is not cp's fault, but the
 behaviour is quite surprising to the users, so maybe it would be worth
 warning in man page?
 
 Something like
 
-x, --one-file-system
   stay on this file system
 
 Note that on systems that allow mounts over non-empty
 directories (like Linux), cp / -ax (destination) will
 not copy whole filesystem. In particular, content of
 /dev will not be usually copied, because distributions
 mount tmpfs over /dev.
 
 [Ok, there's hopefully better wording...?]

Well this issue is not restricted to -x of course,
but I suppose it's might be a good place to put a warning.
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.
That info would be more appropriate in the texinfo manual,
than the man page I would think.

thanks,
Pádraig.






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

2013-05-10 Thread Andreas Schwab
Pádraig Brady p...@draigbrady.com 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.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
And now for something completely different.





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

2013-05-10 Thread Bob Proulx
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