Difference Between /mnt and /media
Published on 2020-06-12 19:00:00+02:00
In this article I will try to answer questions like: What is the difference between /mnt and /media in FHS and
*nixes?, Why was /media added to FHS?, and perhaps What is the purpose of /mnt, and what is it for
To be fair, I'm somehow conflicted now. For some people the answer is so simple that they don't bother to write it
down. I'm serious. It's not like I've ever been optimistic about stackoverflow or other subsites of stackexchange, but
that one answer really gave me a good chuckle. I won't link it, because it almost feels like name shaming, but hell as
long as it's there, you'll figure out your way, won't you?
Now, now. One could use no brain at all, and say that the descriptions in the standard are different, therefore they
are different. Completely discarding things like intentions, history, purposes or use cases. They are different, because
they are different. That is in fact true. It's hard to deny something that is clearly visible. Let's take a look at
3.11. /media : Mount point for removable media
This directory contains subdirectories which are used as mount points for removable media such as floppy disks, cdroms
and zip disks.
3.12. /mnt : Mount point for a temporarily mounted filesystem
This directory is provided so that the system administrator may temporarily mount a filesystem as needed. The content of
this directory is a local issue and should not affect the manner in which any program is run.
Based on those, the usual answer is: /mnt is for system administrator and /media is for the system itself. In other
words: /mnt is for you and /media is not. This answer is quite satisfying, unless you actually read it. The 3.11 does
not say a word about who mounts stuff in /media. Even the rationale section doesn't. However, it does mention the reason
why /media was added: to stop adding mount points to root (e.g. /cdrom, /floppy).
It also mentions that e.g. /mnt/cdrom and derivatives have been used as temporary mount points for removable media.
The only reason why the /media was added is because of, and I quote, tradition of using /mnt directly as a mount point.
This means, that the standard partially acknowledges that /mnt and /media are interchangeable and actually can be
equivalent in how they are used. The wordings of both sections are different. That's undeniable. On the other hand, the
meaning is left to be discussed. Or is it?
Originally, there have been voices that said something among the lines of: "Ay folks, ain't those the same?" Even in
the bug report from 2003 that introduced this change
to FHS in 2.3 version. They all have been ignored. Year later,
the question was asked again, and the answer was what
we know now: /mnt is for temporary mount points which may not be media.
What is not media? Where to draw a certain line between mounted zip file and a floppy disk? How long does a gate
needs to be to be considered a tunnel? What is the difference between "removable" and "temporary" in this particular
case? Is this really the moment we get into discussion of semantics and of what is "medium"? I feel like I already did
this pun on this blog.
If I want to write a script that automatically and temporarily mounts a filesystem of one of my microcomputers
whenever they are available in the local network. Should that go to /media or /mnt? Is the sshfs a medium or not?
I mean, it's between my filesystem and the actual mounted things in the microcomputer filesystem, but is it really?
Are media limited to physical things like cd, floppy or usb drives?
The difference is so ambiguous and unspecified, that it just feels completely surreal to me. Moreover, this slight
changes to understanding of what "removable media" is, and what it perhaps could become, and what people will mount in
future, was also originally pointed out. It feels like a good time to revisit those points.
One more question remains. Is this separation needed in any sense? I think not. In my home system I swiftly use more
than one automatic manager for mounting various things: from USB drives to whole external devices with their own
operating system. I use the very same directory to manually manage temporary devices. I am yet to run into a
significant issue with this approach.
To summarize, there is no particular difference between /media and /mnt in FHS. If anything /media has a defined
structure of subdirectories user can expect to find in it, and /mnt doesn't. In various implementations of FHS there
might be some conventions and traditions added on top of that like: /media is for stuff that is mounted automatically
by the system, and /mnt is for user or sysadmin to use. Overall, the use cases overlap, and it was known from the very
beginning, but it was ignored due to reasons.
Originally, /media was added in FHS 2.3 as a part that was not included in 2.2 from 2.2-beta release. The goal was
to limit creation of temporary mount points in the /. Did it work out? I think not, considering that it could easily be
substituted by /mnt or vice versa.