Why can't we mount multiple filesystem in same mountpoint?

Joined
Apr 16, 2023
Messages
155
Reaction score
19
Credits
1,515
Systems impose semantics to clarify functionality. For example, a system may disallow a mount over a directory that contains files; or it may make the mounted file system available at tha directory and obscure the directory's existing files until the file system is unmounted, terminating the use of the file system and allowing access to the original files in that directory. As another example, a system may allow the same file system to be mounted repeatedly, at different mount points; or it may only allow one mount per file system.
  • Galvin et al, Operating System Concepts

When a file system is mounted, the contents of the directory at that mount point are unavailable to users unitl the file system is unmounted.
  • Deitel et al, Operating System
So, basically this means we're trying to say at one mount point we can have only one file system. i.e a directory can have only one filesystem.

But why?

In a tree structured directory, I see no reason to allow a mount point to have multiple filesystems.

When I asked this to my professor, he asked me this question.

So to which file system would you store a resource that goes to a directory with multiple mounts?
I didn't understand what he meant. The below figure is how I visualize my system would look like.

WKMGt.png

PS can we call an umounted file system as "device"?
Z7tQ9.png

Source: https://warwick.ac.uk/fac/sci/physi...teaching/operating_systems/l5_filemgt2013.pdf
 


Why would you want to or need to?
If you need more file-systems, just make more mount points. ( They will have to be named differently )

But if you really could do this ( there are a few ways ) how would it help you. You would be reading a writing
the same file to and from the "same disk" effectively. So it would look like one single disk to you.

.. but you say.. but it's really two disks.. ( perhaps for backup / redundancy )
What you want in this case is a RAID array, disk mirroring, or disk clustering.

... or maybe what you really want is a bigger disk. /home is only 20GB and the disk it's on is almost full.
Again, you can use a RAID array to group a number of disks together to look like one huge disk.
The other way to do this, is with a Logical Volume Group, this is a software based disk array.
You can put multiple disks into a volume group, so it looks like one big disk.
 
When a file system is mounted, the contents of the directory at that mount point are unavailable to users unitl the file system is unmounted.

I missed this part.
You can create a directory. ( It could be anywhere, with any name ) and you can put files in this directory.

However Linux lets you mount another disk to this directory.

mkdir /home/test
cp /files/* /home/test
ls /home/test


You will see the files here.

mount /dev/sdb1 /home/test
ls /home/test


Now the files have disappeared, but you can copy new files there. ( which would go to /dev/sdb1 )

but when you unmount /home/test, the new files are gone, and the old files return.
 
Last edited:

Members online


Top