Peeking at the contents of a mount point
kogorman at gmail.com
Wed Sep 12 14:53:34 UTC 2012
On Wed, Sep 12, 2012 at 12:57 AM, Karl Auer <kauer at biplane.com.au> wrote:
> On Wed, 2012-09-12 at 15:40 +1000, Basil Chupin wrote:
>> On 12/09/12 12:25, Kevin O'Gorman wrote:
>> > I recall some time ago seeing a command -- a variant or argument to
>> > 'mount' I think -- which allowed you to see the real contents of a
>> > mount point while something else was still mounted on it.
>> > I've looked back through 2 years of postings and can't find it.
>> > Anybody have a clue?
>> The "real mount point" is what you have mounted on it already. And I
>> don't know of any "fake" mount points :-) .
> A mount point is a directory - like "/". A mount point can contain
> files, just like any other directory. If a filesystem is mounted on a
> directory that contains files, any files below the mount point are
> hidden by the mounted filesystem. If you unmount the filesystem, the
> files below the mount point become visible again.
> Try it - put a file in (say) /mnt, then mount something on /mnt. The
> file you created will "disappear" - to reappear unharmed when you
> unmount the filesystem.
> You can see the contents of the mountpoint under a mounted filesystem by
> binding the mount point to another name:
> mount --bind /mnt /mnt_view
> ... then "ls /mnt_view" should show you the "hidden" files.
> This is from memory, so do please test carefully.
> Regards, K.
That's what I thought too, but it does not work. The --bind option
lets me place part of the heirarchy in multiple places, but does not
allow me to expose any underlying mount points.
For example, my home directory is mounted separately so that any
runaway experiments don't use up the disk space of other things, but
if I have root do
mount --bind /home/kevin /mnt
I see the same thing as if I just did
programmer, n. an organism that transmutes caffeine into software.
More information about the ubuntu-users