To show bind mount source path for mount after v2.25.2

UPDATE, I'm reopening this question as findmnt is not the answer.

Basically the summary of the OP is that since version 2.25.2, mount does not show its source path any more:

$ mkdir -v /export/crash
mkdir: created directory '/export/crash'

$ mount -v --bind /export/crash /var/crash
mount: /export/crash bound on /var/crash.

$ mount | grep crash 
/dev/sdb2 on /var/crash type ext3 (rw,noatime,nodiratime,data=ordered)

Before mount v2.25.2, it used to report the mount source:

$ mount | grep crash 
/export/crash on /var/crash type ext3 (rw,noatime,nodiratime,data=ordered)

This is very inconvenient for me, as

  • I was able to do umount mount_source before, but now I can only do umount mount_target
  • I bind mount from certain source as read-only, and I have a script to turn RW on and off for those bind mounts. But with the new mount (v2.25.2+), I'm no longer able to do that.

And the findmnt is not the answer to my above problems:

$ findmnt | grep crash
└─/var/crash   /dev/sdb2[/crash]   ext3    rw,noatime,nodiratime,data=ordered

I.e., it doesn't show that /var/crash comes from /export/crash either. (NB, if you test with bind mount from /tmp/crash or alike, you will see /tmp/crash in the source, but I need to see the /export part, my mount point).

Please help.

== The following is the original OP ==:

The syntax for bind mount has always been

mount --bind olddir newdir

However, I noticed a difference in how mount reports the bind mounts between Ubuntu 14.10 Utopic and Ubuntu 15.04 Vivid, i.e., mount v2.25.1 and mount v2.25.2.

In Ubuntu 14.10 Utopic, the mount reports the bind mounts like this:

$ mount | grep www
/my/path/to/www on /var/www type none (rw,bind)

$ mount -V   
mount from util-linux 2.25.1 (libmount 2.25.0: selinux, assert, debug)

However in Ubuntu 15.04 Vivid, it is like this:

$ mount | grep www 
/dev/sda11 on /var/www type ext3 (rw,noatime,nodiratime,data=ordered)

$ mount -V   
mount from util-linux 2.25.2 (libmount 2.25.0: selinux, assert, debug)

I.e., the bind mount source path is missing from the mount report. For both cases, I use the exact syntax for bind mount as above.

How can I make mount show bind mount source path in Ubuntu 15.04 Vivid ( mount v2.25.2) then?


What you can do is grep the /proc/self/mountinfo:

$ less /proc/self/mountinfo | grep /my/mount
221 84 8:3 /bind/source /my/mount rw,relatime shared:32 - ext4 /dev/sda3 rw,data=ordered

Have you considered using findmnt?

mount stores its information in /proc/mounts (or /proc/self/mounts), which is symlinked to /etc/mtab. mount will simply cat this file, and it no longer stores bind information.