/etc/mtab vs. /proc/mounts
Rémi Forax
forax at univ-mlv.fr
Mon Jan 31 12:13:36 PST 2011
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
man mount
see section "The /etc/fstab, /etc/mtab and /proc/mounts files"
Rémi
More information about the nio-dev
mailing list