What if mounting point conflicts with local directory?

user180574 asked:

This might help me hunt down some system configuration bug.

Suppose I make a local directory (e.g., “/foo”) in one disk partition, and copy some files to it. But later on I forget about it, and configure the same directory as mounting point for another disk partition in /etc/fstab.

Now if I reboot the system, what will happen, will /foo still hold local files or point to the other disk partition?

Thanks.

My answer:


Both.

When you mount some device to /foo, then the files on the new device appear, and the ones on the original device are hidden.

If you unmount /foo, then the original files will reappear.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.