-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Way to distinguish bind mounted path ? #600
Comments
Can you attach a copy of |
/proc/mounts here
|
To me that looks like the mount options would be no help in this case. There is no way to tell the difference between |
@SuperQ
in terms of monitoring storage, |
The Duplicate bind mounts are indistinguishable from the kernel's perspective, similar to a hard link. There are two options:
|
There is a better source of information than /proc/mounts: /proc/self/mountinfo. That has added data as to what subdirectory from the device is mounted at the destination. For a bind mount of /data/shared/www into /var/www/shared, it looks like this:
Perhaps the most prometheus-ish way to do this would be to just export this information (mountroot="/shared/www" for the second mount or similar). Then downstream rules can just choose to ignore any timeseries that don't have mountroot="/". This won't help OP since they're bind-mounting the root of the filesystem (which truly is indistinguishable), but it will help those of us who bind-mount subtrees, which is very common (and having many random subtrees mounted is more common than having the root mounted many times). Note that symlinks are usually an option for bind-mounting the root, but not for subtrees: one of the nice things about bind-mounting subtrees is that lets you bypass permissions checking for the parent directories at the source, which enables some interesting use cases that symlinks cannot provide. |
@marcan That's a good idea. I think it's something we can implement. |
I think we should be dropping such filesystems, as we already have the usage information from the actual filesystem mount. I'm not sure it's a good idea to add another label onto a key metric which already has more labels than it technically needs. |
@brian-brazil I agree, we don't need them in the use metrics. We could include the bind mounting as a separate |
The tricky bit is that it's possible to unmount the bare-root filesystem and leave the bind mount. At that point you'd have to implement deduplication in the mount list to make sure you don't drop any useful data. Perhaps this algorithm: for a given mounted device, prefer the mount with the least number of components in the mountroot, then among those prefer the oldest one (coming earlier in mountinfo). This approach would fix OP's problem. |
@marcan I was considering deduplication by "first listed" in the mountinfo. This means that it's possible for labeling to shift. But I'm guessing the kernel data structure that holds |
There's nothing saying you can't normally mount a filesystem twice, and I think in that case we'd want to expose both.
I can imagine that getting high cardinality and high churn, and I'm not sure what it's gaining us. |
There's no way to distinguish a filesystem mounted twice from a filesystem mounted and then its root bindmounted elsewhere. As far as I know both of those result in identical kernel state. Ultimately I think the options are: either show the first mount in mountinfo order, or show root mounts only (but what if a filesystem is only mounted from a subdirectory? then show that instead? what if it's mounted multiple times but never at the root?), or implement some kind of priority order and show the first mount only. |
No strong preference, but |
This comment has been minimized.
This comment has been minimized.
i have the impression that just reading |
replying to myself, it seems like the plan is to add a new metric, |
Host operating system:
node_exporter version:
Are you running node_exporter in Docker?
yes
What did you do that produced an error?
With given query below
Result is
Actually second record is bind mounted point.
If I can get mount options it would be helpful, to exclude the record.
The text was updated successfully, but these errors were encountered: