LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How do I find the target directory (not the target fs) of a mount -bind (http://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-find-the-target-directory-not-the-target-fs-of-a-mount-bind-4175445377/)

raananh 01-13-2013 04:36 AM

How do I find the target directory (not the target fs) of a mount -bind
 
Hi,
Let's say someone entered the following command without my knowledge:
mount -o bind /CommonData/BindTarget /MyData/BindSource

I can see that /MyData/BindSource is a mount point by using "mount" or "df".

My questions:
1. Can I tell if /MyData/BindSource is a bind mount or a regular mount?
2. If yes, how can I find the bind target path? (in this example /CommonData/BindTarget)

All I managed to find using mount and df is the filesystem (or the device) that contains /CommonData/BindTarget (for example the fs that is mounted on /CommonData), but not the actual path sub directory inside it that is the bind target (e.g. /CommonData/BindTarget).

Its probably something very simple to find, but I've googled some and didn't find info.

Thanks,
raananh

unSpawn 01-13-2013 08:52 AM

Code:

grep bind /etc/mtab
# or nicer:
awk '/bind/ {print "source: "$1" bind target: "$2 }' /etc/mtab
# but it's basically the same nfo


raananh 01-13-2013 09:18 AM

Thanks a lot!
I don't have /etc/mtab on my linux (android phone) but I googled "mtab" thanks to you, and discovered I could find the bind info on my linux like that:
Code:

cat /proc/self/mountinfo
Then I can use text manipulation to isolate what I need.
Thanks,
raananh


All times are GMT -5. The time now is 09:15 AM.