How do mount namespaces and bind mounts let one directory appear in two places?
AdvancedConceptFilesystem Hierarchy, Inodes & Links
Answer
A bind mount attaches an existing directory tree at another mount point; both paths refer to the same inodes.
sudo mount --bind /data/www /var/www
sudo mount -o remount,bind,ro /var/www # make the view read-only
findmnt /var/www
Mount propagation (shared, slave, private) controls whether mounts made under one copy appear in the other or in other mount namespaces. Container volumes and Kubernetes hostPath are built on bind mounts.
More on Filesystem Hierarchy, Inodes & Links
Explain the purpose of the main top-level directories in the FHS.BeginnerWhat is the "/usr merge"?IntermediateWhat are /proc and /sys?BeginnerWhat is an inode? What does it store and what does it NOT store?BeginnerA disk shows free space but you get "No space left on device". Why?IntermediateWhat is a hard link?Beginner