Re: Overmounting a filesystem

Albert Cahalan (albert@ccs.neu.edu)
Wed, 10 Apr 1996 22:10:37 -0400 (EDT)


>>>> Currently it seems Linux does not permit overmounting a filesystem
>>>> (mounting a filesystem on top of another, on the same path).

>> he really wanted something like:
>>
>> mount /dev/hda2 /home
>> ... do things
>> mount /dev/hda3 /home
>>
>> Is that right? If so, it's true you can't do that currently.
>
> The point is whether the second mount should implicitly umount the
> old disk, or just hide it. /etc/mtab currently can't handle stacked
> mounts (same for /proc/mounts). Also mount(8) will have some trouble
> selecting the correct entry from /etc/fstab.

This should work:

mount /dev/hda2 /home
... do things in /home (hda2)
mount /dev/hda3 /home
... do things in /home (hda3)
umount /home
... do things in /home (hda2)
umount /home

Mounts need to be in a stack. For /proc/mounts, /etc/mtab,
and /etc/fstab, the order should be significant. The active
mount goes first in the file, followed by others below it.

It would be _great_ if this would work too:

mount /dev/hda2 /home
mount /dev/hda3 /home
umount /dev/hda2 # Rip mount out from under other one

That's no so important though. A stack would be good enough.
BTW, mount might ask for a --force option before doing this.
It's a bit like hard linking your directories.