LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Doubt abt the files on mountpoint!!! (https://www.linuxquestions.org/questions/linux-general-1/doubt-abt-the-files-on-mountpoint-630023/)

goosygeek 03-23-2008 10:33 AM

Doubt abt the files on mountpoint!!!
 
Hi Guys,

This questions may sound dump or familiar, but plz clear my doubt. This is my question!


I have a directory named /dir1 which contains some files and folders. And using the mount command if I mount a filesystem on /dir1. The contents on that folders where not displayed. But once if I umount the filesystem. The folders and files are visible again. and my questions, why these files wheren't displayed when /dir1 is used as a mountpoint. Plz clear my doubt and make me understand unix in detail.



With Hopes,
Vimal.

bigrigdriver 03-23-2008 11:04 AM

Take two pages of paper; one written page and one blank page. Place the blank page over the written page and you can't see the words on the written page.

The same thing happens when you put files in a directory, then use that directory as the mount point for another source of files. The mounted filespace covers the directory in which you placed the files, and you won't see them again until you unmount the covering filespace.

David the H. 03-23-2008 11:06 AM

It's normal. The mounted filesystem always overrides the original contents of the directory. Unless you have some special merging system you can only access one block device at a time at a single location.

goosygeek 03-24-2008 08:20 AM

Thanks a lot for all those answers. But my doubt still remains uncleared. Let me put my question this way.

The contents of a directory would be inodenumber=filename/inodenumber=directoryname. So when I mount a filesystem what happens to this info's??? ( where are they stored ). It must be stored somewhere bcz, when we unmount the other filesystem. The old contents of that directory is visible.

Thanks in Advance,

Vimal

pixellany 03-24-2008 08:37 AM

This is easy--once you understand it.....;);)

Filesystems, inodes, etc. live on partitions--sections of the physical disk. The directory tree establishes a system for sorting things into specific directories (regardless of what partitions are involved)

In the simplest system, one partition is mounted at "/" (AKA the root of the directory tree). This partition will have entries for all the nodes (eg /home, /bin, /usr, etc....). The mounting of this one partition is specified as part of the boot process.\

Think of "mounting" as connecting a partition to the directory tree. Starting with the above example using only one partition, you can mount (connect) partitions anywhere else on the tree. When you do that, the system sees the content of the newly mounted partition, and not what was there previously. The analogy provided earlier is a good one--adding a sheet of paper hides the earlier content. When the sheet is removed the other content is still there.

Note that you can have multiple partitions (sheets of paper) at one mount point--only the last one mounted (the top of the pile) is visible. You cannot however mount a partition at two different mountpoints--this would create ambiguity (something computers do not handle well)


All times are GMT -5. The time now is 04:04 PM.