Andreas Haumer, Altendorf 37, A-3242 TEXING
Büro: Karmarschgasse 51/2/20, A-1100 WIEN
Tel: +43-1-6060114-0
Fax: +43-1-6060114-71

The /etc/mtab vs. /proc/mounts Issue


Linux systems use two different mechanisms to keep track of mounted filesystem. One is implemented in the kernel and exposes this information to the user-space via /proc/mounts. The other approach is to let the bookkeeping be done in user-space by the mount utility using a separate file, namely /etc/mtab.

While the user-space approach means keeping redundant information around that can become inconsistent, the kernel-space approach suffers from certain implementation deficiencies that prevent it from providing all the information to user-space. Even worse, the implementation in the Linux 2.2.x kernels performs only sloppy boundary checking and can corrupt kernel memory.

We therefore propose to fix the Linux kernel implementation of /proc/mounts and get rid of /etc/mtab (or replace it with a symlink to /proc/mounts) so that all information about mounted filesystems is provided by the kernel itself.

Click here to go to the end of the page to get the patches that already exist and to view our proposed plan to sort things out. (Or keep on reading for a more in-depth discussion of this issue...)

Defining the Problem

Unfortunately, each of the two mechanisms discussed in the overview has its deficiencies and cannot be used as a general purpose solution.

What's Wrong With /proc/mounts?

The kernel-space mechanism has the following deficiencies:

What's Wrong with /etc/mtab?

The approach taken by the mount utility that is part of the util-linux package has some deficiencies too:

Getting Things Right

We suggest the following plan to get this issue sorted out: