I'm curious about the file or symlink /etc/mtab
. I believe this is a legacy mechanism. On every modern linux I've used this is a symbolic link to /proc/mounts
and if mtab
were to be a regular file on a "normal" file system /etc
there would be challenges in making software work with mount namespaces.
For a long time I'd presumed that one of two things were true. Either:
- We're waiting for software referencing
/etc/mtab
to age out or be updated - Other non-linux OS still use the same file name and the link is there for cross platform compliance
However both of these seem shaky ideas. I can't find good reference to any modern OS keeping the same file name outside Linux. And it seems to have lived for much too long to be simply a backward compatibility issue; far more significant changes seem to have come and gone in that same time.
So I'm left wondering if /etc/mtab
is really just there for historic reasons. Is it in any way officially deprecated? Is there any solid modern reason [as of 2023] to keep it?
I don't want to delete it from my system, but as a software developer I'd like to understand its usefulness and whether to avoid it.
/etc/mtab
isn’t relevant there. In any case the Linux/etc/mtab
isn’t even compatible with old Unix-stylemtab
. – Stephen Kitt Apr 16 '23 at 10:40mount
andumount
. – Stephen Kitt Apr 16 '23 at 11:29git log -S "The support for regular classic"
later, we see that commit b6cc121043854e1048d020bc1d73d932df89eb4b documented the deprecation in 2018. (not saying it, instead instead showing off how you can find such info yourself) – Marcus Müller Apr 16 '23 at 11:32