/etc/mtab vs. /proc/mounts
Alan Bateman
Alan.Bateman at oracle.com
Mon Jan 31 12:03:09 PST 2011
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