Score:0

Is /proc/mounts file depracated?

ye flag

I have been reading at several places that we should no longer refer to /proc/mounts and instead it is better to rely on /proc/self/mountinfo file. For example, see this question:

/proc/self/mountinfo per-mount-options vs per-super-options

However, I can't find any official documentation stating the same.

Score:2
ca flag

Is /proc/mounts file depracated? ... I can't find any official documentation ...

According proc(5) — Linux manual page

/proc/mounts

Before Linux 2.4.19, this file was a list of all the filesystems currently mounted on the system. With the introduction of per-process mount namespaces in Linux 2.4.19 ... this file became a link to /proc/self/mounts, which lists the mounts of the process's own mount namespace. ...

See also

ll /proc/mounts
lrwxrwxrwx. 1 root root 11 Jul 18 14:45 /proc/mounts -> self/mounts
codego123 avatar
ye flag
Thanks for sharing this. While it states that it is a link to /proc/self/mounts, it nowhere says that this is not a reliable method. So wondering if it is ok to use /proc/mounts?
U880D avatar
ca flag
`/proc/mounts` is just a symlink now. Since it is pointing to properly defined target there is no need to use the "old" one other than for backward compatibility. And it might disappear in the future. Therefore, just use the final target from the beginning.
codego123 avatar
ye flag
Thank you @U880D That answers my question :) So basically I can just use /proc/self/mounts or /proc/self/mountinfo instead of /proc/mounts.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.