Re: Overmounting a filesystem

William E. Roadcap (roadcapw@cfw.com)
Tue, 9 Apr 1996 14:30:33 -0400 (EDT)


On Tue, 9 Apr 1996, Bryn Paul Arnold Jones wrote:

> On Tue, 9 Apr 1996, William E. Roadcap wrote:
>
> > On 9 Apr 1996, H. Peter Anvin wrote:
> >
> > > Currently it seems Linux does not permit overmounting a filesystem
> > > (mounting a filesystem on top of another, on the same path).
> >
> > Just tried it, and it works:
> >
> > /dev/hda1 on / type ext2 (rw)
> > /dev/hda2 on /home type ext2 (rw)
> > /proc on /proc type proc (rw)
> > /dev/hda3 on /home/eddie type ext2 (rw)
> >
> >
> That's not what he ment (i think anyway), you can mount over existing
> files, say you had /mnt, with floppy, cdrom, .... in, you can mount
> something on /mnt, but you woulden't be able to see the stuff in orignal
> directory. ie:

Perhaps that is not what he meant, but (barring the kernel code in the
original message) it is what he asked.

The behaviour you describe was discussed on the list a month or two ago.
It is common behavior of Unix filesystems to hide the files which exist in
directory once you mount a filesystem onto that directory. I find nothing
unacceptable about this behaviour, infact is seems quite logical to me.

If you need to mount a filesystem onto a populated directory, then you
should create an empty subdirectory there.

> you get the idea, if you had what's variously been called unionfs, ufs,
> and ifs (don't ask why, you don't want to know), you can mount multiple
> devices on one mount point, and see 'through' the top fs to fs's below.
> I don't how it would handle mounting a fs over a populated directory, but
> I think it could be made to handle this either way (ie mounting would
> either hide the underlieing files, or allow them to show through).

Here again, just create subdirectories under /mnt for these various
filesystems. Asking for the kernel to handle this automatically, IMHO,
is just plain lazyness and bloat, again IMHO.

Besides, if you setup your /etc/fstab and /mnt hierarchy ahead of time,
it's simply a matter of issuing something like

mount /mnt/cdrom
or
mount /mnt/fd0
etc...
__
William E. Roadcap mailto://roadcapw@cfw.com
TITUS Software ftp://titus.cfw.com/pub
Waynesboro, Va (USA) http://www.cfw.com/~roadcapw