[sf-lug] Linux mounts ... and overmounts and ...

Michael Paoli Michael.Paoli at cal.berkeley.edu
Mon Nov 8 18:42:00 PST 2021

> From: "Rick Moen" <rick at linuxmafia.com>
> Subject: Re: [sf-lug] correct URL?
> Date: Mon, 8 Nov 2021 12:31:39 -0800

> Reminds, me -- not the same problem, but a possibly useful tip:  In any
> mountpoint directory, I place a zero-length, root-owned file named
> "NOTHING_IS_MOUNTED_HERE".  Point is, if ever a normal mount is for some
> reason not in effect, that file stands out even if I'm tired or
> undercaffeinated.  (I choose to avoid automounter daemons, hence
> mountpoints don't arise dynamically.)

That's certainly an approach.

In the land of Linux, I like to not only look at the output of
mount, but also consult /proc/mounts - as that's the kernel's idea
of what's mounted where, whereas the output of mount is a bit
more human friendly ... except when it isn't - like in some
cases/version and when /etc/mtab is stale - e.g. root filesystem
is mounted read-only.

Also, for most *nix filesystems, the inode number of the root directory
of a filesystem, as seen from within that filesystem, is 2.
So, e.g. ...
$ (for mp in $(df -T -x tmpfs -x devtmpfs -x iso9660 -x fuse.zfs | awk  
'{if(NR!=1)print $7;}'); do cd "$mp" && ls -id .; done) | sort | uniq -c
      18 2 .

Now ... Linux bind mounts ... very handy ... but still need a better  
way to determine/show with existing bind mounts, exactly what's  
mounted on what.
Better way might exist, but don't think I've found a good/great answer
on that one yet.

More information about the sf-lug mailing list