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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
|
.TH BIND 1
.SH NAME
bind, mount, unmount \- change name space
.SH SYNOPSIS
.B bind
[
.I option ...
]
.I new old
.PP
.B mount
[
.I option ...
]
.I servename old
[
.I spec
]
.PP
.B unmount
[
.I new
]
.I old
.SH DESCRIPTION
.I Bind
and
.I mount
modify the file name space of the current process
and other processes in the same name space group
(see
.IR fork (2)).
For both calls,
.I old
is the name of an existing file or directory in the
current name space where the modification is to be made.
.PP
For
.IR bind ,
.I new
is the name of another (or possibly the same)
existing file or directory in
the current name space.
After a successful
.IR bind ,
the file name
.I old
is an alias for the object originally named by
.IR new ;
if the modification doesn't hide it,
.I new
will also still refer to its original file.
The evaluation of
.I new
(see
.IR intro (2))
happens at the time of the
.IR bind ,
not when the binding is later used.
.PP
The
.I servename
argument to
.I mount
is the name of a file that, when opened, yields an
existing connection to a file server.
Almost always,
.I servename
will be a file in
.B /srv
(see
.IR srv (3)).
In the discussion below,
.I new
refers to the file named by the
.I new
argument to
.I bind
or the root directory of the service
available in
.I servename
after a
.IR mount .
Either both
.I old
and
.I new
files must be directories,
or both must not be directories.
.PP
Options control aspects of the modification to the name space:
.TP 10
(none)
Replace the
.I old
file by the new one.
Henceforth, an evaluation of
.I old
will be translated to the new file.
If they are directories (for
.IR mount ,
this condition is true by definition),
.I old
becomes a
.I "union directory"
consisting of one directory (the new file).
.TP
.B -b
Both files must be directories.
Add the new directory to the beginning
of the union directory represented by the old file.
.TP
.B -a
Both files must be directories.
Add the new directory to the end
of the union directory represented by the old file.
.TP
.B -c
This can be used in addition to any of the above to permit
creation in a union directory.
When a new file is created in a union directory,
it is placed in the first element of the union that has been bound or mounted with the
.B -c
flag.
If that directory does not have write permission, the create fails.
.TP
.B -C
(Only in
.IR mount .)
By default, file contents are always retrieved from the server.
With this option, the kernel may instead use a local cache to satisfy
.IR read (5)
requests for files accessible through this mount point.
The currency of cached data for a file is verified at each
.IR open (5)
of the file from this client machine.
.TP
.B -q
Exit silently if the
.B bind
or
.B mount
operation fails.
.PD
.PP
.I Mount
takes three additional options.
The first,
.B -k
.IR keypattern ,
constrains the set of
.IR factotum (4)
keys used for an authenticated mount.
The second,
.BR -n ,
causes
.I mount
to skip authentication entirely.
The third,
.BR -N ,
skips authentication and specifies
.B none
as the username to the fileserver.
.PP
The
.I spec
argument to
.I mount
is passed in the
.IR attach (5)
message to the server, and selects among different
file trees served by the server.
.PP
The
.IR srv (3)
service registry device, normally bound to
.BR /srv ,
is a convenient rendezvous point for services that can be mounted.
After bootstrap, the file
.B /srv/boot
contains the communications port to the file system from which
the system was loaded.
.PP
The effects of
.I bind
and
.I mount
can be undone with the
.I unmount
command.
If two arguments are given to
.IR unmount ,
the effect is to undo a
.I bind
or
.I mount
with the same arguments.
If only one argument is given,
everything bound to or mounted upon
.I old
is unmounted.
.SH EXAMPLES
To compile a program with the C library from July 16, 1992:
.IP
.EX
mount /srv/boot /n/dump dump
bind /n/dump/1992/0716/mips/lib/libc.a /mips/lib/libc.a
mk
.EE
.SH SOURCE
.B /sys/src/cmd/bind.c
.br
.B /sys/src/cmd/mount.c
.br
.B /sys/src/cmd/unmount.c
.SH SEE ALSO
.IR bind (2),
.IR open (2),
.IR srv (3),
.IR srv (4)
|