/etc/mtab vs. /proc/mounts

Tigran Mkrtchyan tigran.mkrtchyan at desy.de
Mon Jan 31 12:16:10 PST 2011

I guess one of the reasons can be that you may mount with -n option.
Then there will be no entry in /etc/mtab file.
Nevertheless, I will expect that   getFileStores() still will show such
mounts and this information available from /proc/mounts


On 01/31/2011 09:03 PM, Alan Bateman wrote:
> I think I need help to (re)understand the difference between /etc/mtab
> and /proc/mounts on Linux.
> On Linux, our getFileStores() is implemented to essentially enumerate
> /etc/mtab. That should give a similar list to what df(1) prints
> although the filtering may be slightly different. On the other hand
> the getFileStore method to get the FileStore for where a file is
> located uses /proc/mounts to find the mount point (folks on this list
> may recall the reasons why we switched to using /proc [1]).  Using
> both leads to at least one reported anomaly where it has been observed
> that getFileStore returns a FileStore representing the root file
> system with both a name and type of rootfs but df -T (and
> getFileStores) report something different (/dev/sda1 and ext4 on one
> system I tried). I'm trying to figure if this code should be changed
> and what the right answer is for this case. Any suggestions?
> Thanks,
> -Alan
> [1] http://mail.openjdk.java.net/pipermail/nio-dev/2009-May/000545.html

More information about the nio-dev mailing list