GNU bug report logs - #14383
cp --one-file-system / will not copy whole root filesystem

Previous Next

Package: coreutils;

Reported by: Pavel Machek <pavel <at> ucw.cz>

Date: Fri, 10 May 2013 16:05:02 UTC

Severity: wishlist

To reply to this bug, email your comments to 14383 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#14383; Package coreutils. (Fri, 10 May 2013 16:05:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Pavel Machek <pavel <at> ucw.cz>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Fri, 10 May 2013 16:05:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Pavel Machek <pavel <at> ucw.cz>
To: bug-coreutils <at> gnu.org
Subject: cp --one-file-system / will not copy whole root filesystem
Date: Fri, 10 May 2013 12:55:36 +0200
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




Information forwarded to bug-coreutils <at> gnu.org:
bug#14383; Package coreutils. (Fri, 10 May 2013 16:36:01 GMT) Full text and rfc822 format available.

Message #8 received at 14383 <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: Pavel Machek <pavel <at> ucw.cz>
Cc: 14383 <at> debbugs.gnu.org
Subject: Re: bug#14383: cp --one-file-system / will not copy whole root
	filesystem
Date: Fri, 10 May 2013 10:35:25 -0600
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




Severity set to 'wishlist' from 'normal' Request was from Bob Proulx <bob <at> proulx.com> to control <at> debbugs.gnu.org. (Fri, 10 May 2013 16:36:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-coreutils <at> gnu.org:
bug#14383; Package coreutils. (Fri, 10 May 2013 17:31:01 GMT) Full text and rfc822 format available.

Message #13 received at 14383 <at> debbugs.gnu.org (full text, mbox):

From: Pavel Machek <pavel <at> ucw.cz>
To: Bob Proulx <bob <at> proulx.com>
Cc: 14383 <at> debbugs.gnu.org
Subject: Re: bug#14383: cp --one-file-system / will not copy whole root
	filesystem
Date: Fri, 10 May 2013 19:29:47 +0200
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




Information forwarded to bug-coreutils <at> gnu.org:
bug#14383; Package coreutils. (Fri, 10 May 2013 18:04:01 GMT) Full text and rfc822 format available.

Message #16 received at 14383 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Pavel Machek <pavel <at> ucw.cz>
Cc: 14383 <at> debbugs.gnu.org
Subject: Re: bug#14383: cp --one-file-system / will not copy whole root
	filesystem
Date: Fri, 10 May 2013 19:02:59 +0100
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.





Information forwarded to bug-coreutils <at> gnu.org:
bug#14383; Package coreutils. (Fri, 10 May 2013 20:11:01 GMT) Full text and rfc822 format available.

Message #19 received at 14383 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: 14383 <at> debbugs.gnu.org, Pavel Machek <pavel <at> ucw.cz>
Subject: Re: bug#14383: cp --one-file-system / will not copy whole root
	filesystem
Date: Fri, 10 May 2013 22:10:35 +0200
Pádraig Brady <P <at> 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, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-coreutils <at> gnu.org:
bug#14383; Package coreutils. (Fri, 10 May 2013 21:23:01 GMT) Full text and rfc822 format available.

Message #22 received at 14383 <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: 14383 <at> debbugs.gnu.org, Pavel Machek <pavel <at> ucw.cz>
Subject: Re: bug#14383: cp --one-file-system / will not copy whole root
	filesystem
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




This bug report was last modified 12 years and 42 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.