/etc/mtab must be a symlink to /proc/mounts

With linux >= 2.6.26, /proc/mounts contains all of the information in 
/etc/mtab, plus more.  The mount system call can now pass all of the mount 
options to the kernel, so no information is missing in /proc/mounts.  This 
has obviously useful benefits such as read-only root, and the state in 
/etc/mtab never gets out of sync with reality (there are a number of open 
bugs against mount where this occurs).

Additionally, with the addition of per-process namespaces with CLONE_NEWNS to 
clone(2), each process has its own set of mounts, and as such a system-wide 
/etc/mtab is useless: it's only valid in one of the potentially many 
namespaces and can quickly get into a horrible mess.  At this point, 
/etc/mtab *must* be a symlink to avoid breakage.  Note that /proc/mounts is 
now a symlink to /proc/self/mounts for this reason: each process has
potentially different mounts.
相關文章
相關標籤/搜索