[CentOS] nfs cannot see mount points on other machine

Fri Jun 27 16:00:45 UTC 2008
Toby Bluhm <tkb at midwestinstruments.com>

Kai Schaetzl wrote:
> Toby Bluhm wrote on Fri, 27 Jun 2008 08:54:56 -0400:
>
>   
>> I don't understand your talk about "fake" directories. They are not
>> fake, they truly exist in the filesystem.
>>     
>
> They are nevertheless fake. Consider the following:
> - system A has mount points / and /home
> - system B nfs mounts / on A without nohide at /nfs/A
>
> Result is that you see *all* directories of A on B, including /home. There 
> is no way to know that it doesn't exist on A, unless you compare the 
> directories on both machines. There is no indication that you are not 
> writing to A:/home when you write to /nfs/A/home. That is what I call 
> "fake". It's definitely not "hidden". "hidden" comes from "hiding" = you 
> don't see it. I consider this behavior *very* misleading.
>
>   
>> That NFS only exports a single partition at a time is probably due to
>> the duplicate inode problem - maybe other stuff - I don't know. At any
>> rate, just export the additional fs and mount it where you like. Again,
>> nothing mysterious and it has been done that way since NFS was invented.
>>     
>
> That may be so. I'm quite happy with this behavior as long as nfs doesn't 
> pretend that something is there that isn't.
>
> I was asking "where" that faked directory actually exists as it is gone 
> when I unmount. If I understand your explanation correctly if I write to 
> /nfs/A/home I'm actually writing to A, but not to the /home filesystem (as 
> I think) but to a home directory on the / filesystem. Is that correct?
>   

Yes. Let's use some examples. If A:/ is /dev/sda1 and A:/home is 
/dev/sda2, then in your above situation, writes to B:/nfs/A/home will be 
written to /dev/sda1 on A and _not_  /dev/sda2 on A. When A exports /, 
it's actually only exporting the filesystem on /dev/sda1.

> That makes clear why it is gone when I unmount. Further, if I unmount 
> /home on A I should still get /home when I list / on A. 

Yes - you will get the /home that's on /dev/sda1

> Just now that 
> "faked" home on /. Correct?
>
>   
> I understand that this directory *does* exist on A (just not where one 
> would think) *after* nfs mounting. However, from the standpoint of machine 
> B it is a fake. It is artificially being created because an ls on A shows 
> it. The correct behavior would be to *not list* any other mount points in 
> the nfs mount.
>
>
>   


Again, it's not fake, it's not artificial. It's truly there on 
/dev/sda1, the storage device. If you umount /home, rmdir /home, you 
can't mount /dev/sda2 on /home any more can you? If you mkdir /home2, 
you can put stuff in there until you run out of space on /dev/sda1. If 
you mount /dev/sda2 on /home2, the stuff you wrote to /home2 will still 
be on /dev/sda1 and will be hidden by the overlay of /dev/sda2. If you 
umount A:/ from B:/nfs/A and then write to B:/nfs/A - because B:/nfs/A 
will still exist as a real directory - it will be stored in /dev/sda1 on 
B. Whether you mount NFS exports or local disk partitions, it works the 
same way.


By your analogy, umounting /dev/sda2 /home should make /home disappear 
from / because it's not mounted. Or mounting  /dev/sda1 as / should just 
make /dev/sda2 fall into /home without any entry in fstab.


-- 
Toby Bluhm
Alltech Medical Systems America, Inc.
30825 Aurora Road Suite 100
Solon Ohio 44139
440-424-2240 ext203