Skip to contentSkip to conversation

Another question on bind mounts without mtab

DISCUSSION Phillip Susi 2 participants 2 messages Jan 10, 2014 – Jan 13, 2014 Util-Linux package

lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've had another question come up about bind mounts and the lack of mtab and I'm not sure how to answer it because it does seem a more important use case that has been lost than those previously discussed.

If /dev/sda1 is mounted in /, and you bind mount /home/foo to /mnt, then there is no way to tell from the output of mount that it is in fact, the /home/foo directory of /dev/sda1 that is in /mnt. It looks like you just bind mounted the whole drive there, and the subdirectory path is lost.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJS0AXcAAoJEI5FoCIzSKrw/H4H/0tHL4gj0O7Ftj/wC02hRnP2 jz5cSaHntsQPyu4qZ7YAda4D0niuF+dRO/OXOak6QkJS1FgmXVWrKvfgfe+diut9 YcxzQkc8P/uDxpC08Hh00JIy7GN0oSGiITQp7VLBd6c96tdT7rQC8AgymaSnBwfT BDA65x7StqFcWi46l9Te9CG48ZV0XtVGx+IsaV6RR78yO1XLG3cQ/CCV4PNE04zr DcsfA1fhVfTkiRWEp4AxjrDuciLe8NSXk5mUd1GuL3I9CmrLJIkMZ7DMu1ucAiSQ Q0u/KSfvfpT211TwDfCfk9Bc+uPfnfxrrLWYwejU0uJI/qJIC/DuX314mIEr6n4= =d4lU
-----END PGP SIGNATURE-----

maintainer
#1 lore raw
Quoted 7 lines · Phillip Susi

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've had another question come up about bind mounts and the lack of mtab and I'm not sure how to answer it because it does seem a more important use case that has been lost than those previously discussed.

Quoted 5 lines

If /dev/sda1 is mounted in /, and you bind mount /home/foo to /mnt, then there is no way to tell from the output of mount that it is in fact, the /home/foo directory of /dev/sda1 that is in /mnt. It looks like you just bind mounted the whole drive there, and the subdirectory path is lost.

See findmnt output, the /proc/self/mountinfo contains info about the mounted filesystem directory (usually '/', but /home/foo in your example).

Note that I'd like to learn people to use findmnt(8) rather mount output. The mount(8) output is there mostly for backward compatibility.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com