[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tim Waugh <address@hidden>] directory mounted with --bind causes cp
From: |
Jim Meyering |
Subject: |
Re: [Tim Waugh <address@hidden>] directory mounted with --bind causes cp -R to fail |
Date: |
Mon, 31 Mar 2003 22:10:30 +0200 |
> Date: Mon, 31 Mar 2003 14:17:08 +0100
> From: Tim Waugh <address@hidden>
> To: address@hidden
> Subject: directory mounted with --bind causes cp -R to fail
> Message-ID: <address@hidden>
>
> Original bug report at:
> https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=86302
>
> Under Linux it is possible to have a special 'bind' mount type, which
> has the effect of remounting part of the file hierarchy somewhere
> else. But this confuses 'cp --preserve=links':
>
> Run these commands as root:
> mkdir -p src/{x,y}
> mount --bind src/x src/y
> cp --archive --one-file-system src dst
>
> Is this a cp bug, or expected behaviour?
>
> Tim.
Hi Tim,
Thanks for forwarding that.
Could it be that there's a problem with the way `mount --bind' works?
With linux-2.4.19, I see that the two directories created above
have the same dev/inode numbers. That doesn't seem right.
I would have expected the device numbers to be different.
This shows they have the same device numbers
(using your example):
# cd src; stat --format='%d %n' [xy]
773 x
773 y
But are they really both on the same `device'?
If so, I should be able to make a hard link from
a file in one to the other:
# touch x/foo
# ln x/foo y/bar
ln: creating hard link `y/bar' to `x/foo': Invalid cross-device link
[Exit 1]
Whoops. We can't do that.
And the failure suggests that they really are on separate devices.
So what's the deal? I suspect that this is all due to a deeper problem.
BTW, the fact that rsync succeeds merely shows that
rsync doesn't complain about hard-linked directories.
`cp -a' could do the same thing, but then we wouldn't
have discovered this inconsistency :-)