Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • 6
    @Gilles Actually, you can do this simply using findmnt | fgrep [ as explained here. Commented Mar 6, 2012 at 16:39
  • 1
    @Gilles What mount --version are you using that records any bind information in /etc/mtab? I am using version 2.20.1 and I looked at the latest sources and in neither case do I see bind information recorded anywhere that would allow you to grep for bind. On the other hand, what I suggested in my answer does in fact list bind mounts created with --bind as well as using the bind option. Commented Mar 6, 2012 at 18:16
  • @aculich </etc/mtab awk … is POSIX-compliant (I forget whether it's supported in Bourne). Please check your facts. I can confirm that /etc/mtab has the bind option for a filesystem mounted with mount --bind /source /target on Debian stable (mount from util-linux-ng 2.17.2). Commented Mar 6, 2012 at 21:10
  • @Gilles I deleted my errant comment to remove confusion. You're right, it is indeed POSIX-compliant. Also now I understand the reason we are seeing different behavior of mount and /etc/mtab. You are using Debian stable which has the older version of util-linux-ng; I am using Debian testing which has a newer version that no longer seems to have the same /etc/mtab behavior, which is maybe why @rozcietrzewiacz did not see bind in in /etc/mtab if his distribution is also using a newer version? Commented Mar 6, 2012 at 21:44
  • 1
    @aculich You should post findmnt as an answer. It only works if the target directory is not another mount point, by the way. Try for example sudo mount --bind / foo && findmnt | grep foo Commented Nov 19, 2013 at 22:56