[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: A Basic Mount Observation



Martin McCormick wrote: 
> 	I may just be remembering things the wrong way but it
> seems like that for most of my memory, one could be root and, if
> you cd'd to a mount point, one could mount /dev/whatever on that
> mount point and immediately see the top of the new tree you had
> just mounted.  If you cd'd in to that tree and tried to umount,
> you got the error that the file system was busy which makes sense
> because you are trying to saw off the limb you are sitting on, so
> to speak.
> 
> 	If you cd'd out of the mount point and nobody else was in
> it, you could umount and all was well.
> 
> 	I accidentally discovered now that I can become the root
> user, cd to a mount point and mount something with a subsequent
> ls of my current directory yielding nothing new.  One doesn't see
> the new mount.
> 
> 	If you open another session and look at the mount point,
> the new mount is there.  You can even create a file under the new
> mount which is only visible to you if you didn't cd out of the
> mount point.  Everybody else who looks at that point will see
> what's mounted there and not the test file slipped in under the
> mount.
> 
> 	Has this always been the normal behavior of mount or has
> there been a change?

mkdir point
cd point
touch original
ls
    original
mount /dev/whatever .
ls 
    original
cd ..
cd point
ls
    whatever-was-in-whatever
cd ..
umount point
cd point
ls
    original

This behavior has always been consistent in Linux, as far as I am aware.

The handle to your current directory cannot be changed out from
underneath you; only when you move away from it can it be
released, and from then on you see the new mount.

-dsr-


Reply to: