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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
.\" Copyright (c) 2013 Marcel Moolenaar
.\" Copyright (c) 2013 Craig Rodrigues
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.\"
.Dd July 7, 2013
.Dt MOUNT.CONF 8
.Os
.Sh NAME
.Nm mount.conf
.Nd root file system mount configuration file
.Sh SYNOPSIS
.Pa /.mount.conf
.Sh DESCRIPTION
During the bootup process, the
.Fx
kernel will try to mount the root file system
using the logic in the
.Fn vfs_mountroot
function in
.Pa src/sys/kern/vfs_mountroot.c .
The root mount logic can be described as follows:
.Bl -enum
.It
The kernel will synthesize in memory a config file
with default directives for mounting
the root file system.
The logic for this is in
.Fn vfs_mountroot_conf0 .
.It
The kernel will first mount
.Xr devfs 8
as the root file system.
.It
Next, the kernel will parse the in-memory config file created in step 1
and try to mount the actual root file system.
See
.Sx FILE FORMAT
for the format of the config file.
.It
When the actual root file system is mounted,
.Xr devfs
will be re-mounted on the
.Pa /dev
directory.
.It
If a
.Pa /.mount.conf
file does not exist in the root file system which was
just mounted, the root mount logic stops here.
.It
If a
.Pa /.mount.conf
file exists in the root file system which was just mounted,
this file will be parsed, and the kernel will use this new config
file to try to re-mount the root file system.
See
.Sx FILE FORMAT
for the format of the config file.
.It
If the new root file system has a
.Pa /.mount
directory, the old root file system will be re-mounted
on
.Pa /.mount .
.It
The root mount logic will go back to step 4.
.El
.Pp
The root mount logic is recursive, and step 8 will
be repeated as long as each new root file system
which is mounted has a
.Pa /.mount.conf
file.
.Sh FILE FORMAT
The kernel parses each line in
.Pa .mount.conf
and then tries to perform the action specified on that line as soon as it is parsed.
.Bl -tag -width "XXXXXXXXXX"
.It Ic #
A line beginning with a # is a comment and is ignored.
.It Ic {FS}:{MOUNTPOINT} {OPTIONS}
The kernel will try to mount this in an
operation equivalent to:
.Bd -literal -offset indent
mount -t {FS} -o {OPTIONS} {MOUNTPOINT} /
.Ed
.Pp
If this is successfully mounted,
further lines in
.Pa .mount.conf
are ignored.
If all lines in
.Pa .mount.conf
have been processed and no root file system has been successfully
mounted, then the action specified by
.Ic .onfail
is performed.
.It Ic .ask
When the kernel processes this line, a
.Li mountroot>
command-line prompt is displayed.
At this prompt, the operator can enter the
the root mount.
.It Ic .md Ar file
Create a memory backed
.Xr md 4
virtual disk, using
.Ar file
as the backing store.
.It Ic .onfail Ar [panic|reboot|retry|continue]
If after parsing all the lines in
.Pa .mount.conf
the kernel is unable to mount a root file system,
the
.Ic .onfail
directive tells the kernel what action to perform.
.It Ic .timeout Ar N
Before trying to mount a root file system,
if the root mount device does not exist, wait at most
.Ar N
seconds for the device to appear before trying to mount it.
If
.Ic .timeout
is not specified, the default timeout is 3 seconds.
.El
.Sh EXAMPLES
The following example
.Pa .mount.conf
will direct the kernel to try mounting the root file system
first as an ISO CD9660 file system on
.Pa /dev/cd0 ,
then if that does not work, as an ISO CD9660 file system on
.Pa /dev/acd0 ,
and then if that does not work, as a UFS file system on
.Pa /dev/ada0s1a .
If that does not work, a
.Li mountroot>
command-line prompt will be displayed where the operator
can manually enter the root file system to mount.
Finally if that does not work, the kernel will panic.
.Bd -literal -offset indent
.Li .onfail panic
.Li .timeout 3
cd9660:/dev/cd0 ro
.Li .timeout 0
cd9660:/dev/acd0 ro
.Li .timeout 3
ufs:/dev/ada0s1a
.Li .ask
.Ed
.Pp
The following example
.Pa .mount.conf
will direct the kernel to create a
.Xr md 4
memory disk attached to the file
.Pa /data/OS-1.0.iso
and then mount the ISO CD9660 file system
on the md device which was just created.
The last line is a comment which is ignored.
.Bd -literal -offset indent
.Li .timeout 3
.Li .md /data/OS-1.0.iso
.Li cd9600:/dev/md# ro
.Li # Can also use cd9660:/dev/md0 ro
.Ed
.Pp
The following example
.Pa .mount.conf
will direct the kernel to create a
.Xr md 4
memory disk attached to the file
.Pa /data/base.ufs.uzip
and then mount the UFS file system
on the md uzip device which was just created
by the
.Xr geom_uzip 4
driver.
.Bd -literal -offset indent
.Li .md /data/base.ufs.uzip
.Li ufs:/dev/md#.uzip ro
.Li # Can also use ufs:/dev/md0.uzip ro
.Ed
.Pp
The following example
.Pa .mount.conf
will direct the kernel to do a unionfs
mount on a directory
.Pa /jail/freebsd-8-stable
which has a
.Xr chroot 2
environment.
.Bd -literal -offset indent
.Li .timeout 3
.Li unionfs:/jail/freebsd-8-stable
.Ed
.Sh NOTES
For each root file system which is mounted, a
.Pa /dev
directory
.Em must
exist so that the root mount logic can properly re-mount
.Xr devfs 8 .
If this directory does not exist, the system
may hang during the bootup process.
.Sh SEE ALSO
.Xr nmount 2 ,
.Xr md 4 ,
.Xr boot.config 5 ,
.Xr fstab 5 ,
.Xr boot 8 ,
.Xr loader 8 ,
.Xr mount 8
.Sh HISTORY
The
.Nm
file first appeared in
.Fx 9.0 .
.Sh AUTHORS
.An -nosplit
The root mount logic in the
.Fx
kernel which parses
.Pa /.mount.conf
was written by
.An Marcel Moolenaar Aq Mt marcel@FreeBSD.org .
This man page was written by
.An Craig Rodrigues Aq Mt rodrigc@FreeBSD.org .
|