: /etc/mtab

Michael Torrie torriem at gmail.com
Mon Sep 16 08:14:43 MDT 2013

On 09/16/2013 04:14 AM, Dan Egli wrote:
> Now, suppose that without actually unmounting the file system, the last
> line (the nfs mount) disappears from the file (either by corruption or by
> malice). What would be the actual effect on the system? It wouldn't
> actually unmount the nfs directory would it? In such a hypothetical
> example, the files in the nfs directory would still be accessible under
> /progs, wouldn't they? the system just wouldn't be able to properly unmount
> the nfs directory, correct? Or am I completely wrong on this?

On some systems /etc/mtab is just a file that's periodically updated
somehow (not sure how exactly).  If the file system is read-only
(embedded system or a live CD), mtab may not have the correct
information in it to begin with.  The system still functions just fine,
and all mounts are just fine.  However some commands and scripts
probably depend on mtab being correct.  So in situations where /etc/mtab
isn't write-able, the recommended solution is to symlink it to
/proc/self/mounts, which appears to be the default on some distros anyway.

But no, a corrupt mtab will have no affect on the actual mounts
functioning.  /progs is still accessible.

I'm unable to find the history of mtab anywhere, but it predates Linux I
believe.  And it's purpose is to provide mount information to user-space
programs.  In Linux, the proc file system happens to export this
information in a compatible way, so I can't see any reason not to
symlink mtab to /proc/self/mounts (or just /proc/mounts).

More information about the PLUG mailing list