summaryrefslogtreecommitdiff
path: root/difference_between_mnt_and_media.html
blob: 8bb7b1ff13d655e9a173a3d54b88dca1f5149b3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="aki">
<meta name="tags" content="linux, unix, file, filesystem, hierarchy, standard, media, mnt, mount">
<link rel="icon" type="image/png" href="favicon.png">
<link rel="stylesheet" type="text/css" href="style.css">

<title>Difference Between /mnt and /media</title>

<nav><p><a href="https://ignore.pl">ignore.pl</a></p></nav>

<article>
<h1>Difference Between /mnt and /media</h1>
<p class="subtitle">Published on 2020-06-12 19:00:00+02:00
<p>In this article I will try to answer questions like: <i>What is the difference between /mnt and /media in FHS and
*nixes?</i>, <i>Why was /media added to FHS?</i>, and perhaps <i>What is the purpose of /mnt, and what is it for
/media?</i>
<p>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?
<p>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
them:</p>
<blockquote cite="https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.pdf">
<b>3.11. /media : Mount point for removable media</b><br>
This directory contains subdirectories which are used as mount points for removable media such as floppy disks, cdroms
and zip disks.
</blockquote>
<blockquote cite="https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.pdf">
<b>3.12. /mnt : Mount point for a temporarily mounted filesystem</b><br>
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.
</blockquote>
<p>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).
<p>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.
<p>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?
<p>Originally, there have been voices that said something among the lines of: "Ay folks, ain't those the same?" Even in
<a href="https://bugs.linuxfoundation.org/show_bug.cgi?id=27">the bug report from 2003</a> that introduced this change
to FHS in 2.3 version. They all have been ignored. Year later,
<a href="https://bugs.linuxfoundation.org/show_bug.cgi?id=49">the question was asked again</a>, and the answer was what
we know now: /mnt is for temporary mount points which may not be media.
<p>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.
<p>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?
<p>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.</p>
<img src="difference_between_mnt_and_media-1.png" alt="tunnel is a gate, but longer">
<p>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.
<p>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.
<p>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.
</article>
<script src="https://stats.ignore.pl/track.js"></script>