]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - sbin/mdmfs/mdmfs.8
MFC r368207,368607:
[FreeBSD/stable/10.git] / sbin / mdmfs / mdmfs.8
1 .\"
2 .\" Copyright (c) 2001 Dima Dorfman.
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\"
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 .\" SUCH DAMAGE.
25 .\"
26 .\" $FreeBSD$
27 .\"
28 .Dd March 7, 2016
29 .Dt MDMFS 8
30 .Os
31 .Sh NAME
32 .Nm mdmfs ,
33 .Nm mount_mfs
34 .Nd configure and mount an in-memory file system using the
35 .Xr md 4
36 driver
37 .Sh SYNOPSIS
38 .Nm
39 .Op Fl DLlMNnPStUX
40 .Op Fl a Ar maxcontig
41 .Op Fl b Ar block-size
42 .Op Fl c Ar blocks-per-cylinder-group
43 .Op Fl d Ar max-extent-size
44 .Op Fl E Ar path-mdconfig
45 .Op Fl e Ar maxbpg
46 .Op Fl F Ar file
47 .Op Fl f Ar frag-size
48 .Op Fl i Ar bytes
49 .Op Fl m Ar percent-free
50 .Op Fl O Ar optimization
51 .Op Fl o Ar mount-options
52 .Op Fl p Ar permissions
53 .Op Fl s Ar size
54 .Op Fl v Ar version
55 .Op Fl w Ar user : Ns Ar group
56 .Ar md-device
57 .Ar mount-point
58 .Sh DESCRIPTION
59 The
60 .Nm
61 utility is designed to be a work-alike and look-alike of the deprecated
62 .Xr mount_mfs 8 .
63 The end result is essentially the same,
64 but is accomplished in a completely different way.
65 The
66 .Nm
67 utility configures an
68 .Xr md 4
69 disk using
70 .Xr mdconfig 8 ,
71 puts a UFS file system on it (unless
72 .Fl P
73 was specified) using
74 .Xr newfs 8 ,
75 and mounts it using
76 .Xr mount 8 .
77 It can handle
78 .Xr geom_uzip 4
79 compressed disk images, as long as the kernel supports this GEOM class.
80 All the command line options are passed to the appropriate program
81 at the appropriate stage in order to achieve the desired effect.
82 .Pp
83 By default,
84 .Nm
85 creates a swap-based
86 .Pq Dv MD_SWAP
87 disk with soft-updates enabled
88 and mounts it on
89 .Ar mount-point .
90 It uses the
91 .Xr md 4
92 device specified by
93 .Ar md-device .
94 If
95 .Ar md-device
96 is
97 .Ql md
98 (no unit number),
99 it will use
100 .Xr md 4 Ns 's
101 auto-unit feature to automatically select an unused device.
102 Unless otherwise specified with one of the options below,
103 it uses the default arguments to all the helper programs.
104 .Pp
105 The following options are available.
106 Where possible,
107 the option letter matches the one used by
108 .Xr mount_mfs 8
109 for the same thing.
110 .Bl -tag -width indent
111 .It Fl a Ar maxcontig
112 Specify the maximum number of contiguous blocks that will be laid
113 out before forcing a rotational delay
114 (see the
115 .Fl d
116 option).
117 .It Fl b Ar block-size
118 The block size of the file system, in bytes.
119 .It Fl c Ar blocks-per-cylinder-group
120 The number of blocks per cylinder group in the file system.
121 .It Fl D
122 If not using auto-unit,
123 do not run
124 .Xr mdconfig 8
125 to try to detach the unit before attaching it.
126 .It Fl d Ar max-extent-size
127 The file system may choose to store large files using extents.
128 This parameter specifies the largest extent size that may be
129 used.  It is presently limited to its default value which is 16
130 times the file system blocksize.
131 .It Fl E Ar path-mdconfig
132 Use
133 .Ar path-mdconfig
134 as a location of the
135 .Xr mdconfig 8
136 utility.
137 .It Fl e Ar maxbpg
138 Indicate the maximum number of blocks any single file can allocate
139 out of a cylinder group before it is forced to begin allocating
140 blocks from another cylinder group.
141 .It Fl F Ar file
142 Create a vnode-backed
143 .Pq Dv MD_VNODE
144 memory disk backed by
145 .Ar file .
146 .It Fl f Ar frag-size
147 The fragment size of the file system in bytes.
148 .It Fl i Ar bytes
149 Number of bytes per inode.
150 .It Fl l
151 Enable multilabel MAC on the new file system.
152 .It Fl L
153 Show the output of the helper programs.
154 By default,
155 it is sent to
156 .Pa /dev/null .
157 .It Fl M
158 Create a
159 .Xr malloc 9
160 backed disk
161 .Pq Dv MD_MALLOC
162 instead of a swap-backed disk.
163 .It Fl m Ar percent-free
164 The percentage of space reserved for the superuser.
165 .It Fl N
166 Do not actually run the helper programs.
167 This is most useful in conjunction with
168 .Fl X .
169 .It Fl n
170 Do not create a
171 .Pa .snap
172 directory on the new file system.
173 .It Fl O Ar optimization
174 Select the optimization preference;
175 valid choices are
176 .Cm space
177 and
178 .Cm time ,
179 which will optimize for minimum space fragmentation and
180 minimum time spent allocating blocks,
181 respectively.
182 .It Fl o Ar mount-options
183 Specify the mount options with which to mount the file system.
184 See
185 .Xr mount 8
186 for more information.
187 .It Fl P
188 Preserve the existing file system;
189 do not run
190 .Xr newfs 8 .
191 This only makes sense if
192 .Fl F
193 is specified to create a vnode-backed disk.
194 .It Fl p Ar permissions
195 Set the file (directory) permissions of the mount point
196 .Ar mount-point
197 to
198 .Ar permissions .
199 The
200 .Ar permissions
201 argument can be in any of the mode formats recognized by
202 .Xr chmod 1 .
203 If symbolic permissions are specified,
204 the operation characters
205 .Dq +
206 and
207 .Dq -
208 are interpreted relative to the initial permissions of
209 .Dq a=rwx .
210 .It Fl S
211 Do not enable soft-updates on the file system.
212 .It Fl s Ar size
213 Specify the size of the disk to create.
214 This only makes sense if
215 .Fl F
216 is
217 .Em not
218 specified.
219 That is,
220 this will work for the default swap-backed
221 .Pq Dv MD_SWAP
222 disks,
223 and the optional
224 .Pq Fl M
225 .Xr malloc 9
226 backed disks
227 .Pq Dv MD_MALLOC .
228 .It Fl t
229 Turn on the TRIM enable flag for
230 .Xr newfs 8 .
231 The
232 .Xr md 4
233 device supports the BIO_DELETE command, enabling the TRIM on created
234 filesystem allows return of freed memory to the system pool.
235 .It Fl U
236 Enable soft-updates on the file system.
237 This is the default, and is accepted only
238 for compatibility.
239 It is only really useful to negate the
240 .Fl S
241 flag, should such a need occur.
242 .It Fl v Ar version
243 Specify the UFS version number for use on the file system; it may be
244 either
245 .Dv 1
246 or
247 .Dv 2 .
248 The default is derived from the default of the
249 .Xr newfs 8
250 command.
251 .It Fl w Ar user : Ns Ar group
252 Set the owner and group to
253 .Ar user
254 and
255 .Ar group ,
256 respectively.
257 The arguments have the same semantics as with
258 .Xr chown 8 ,
259 but specifying just a
260 .Ar user
261 or just a
262 .Ar group
263 is not supported.
264 .It Fl X
265 Print what command will be run before running it, and
266 other assorted debugging information.
267 .El
268 .Pp
269 The
270 .Fl F
271 and
272 .Fl s
273 options are passed to
274 .Xr mdconfig 8
275 as
276 .Fl f
277 and
278 .Fl s ,
279 respectively.
280 The
281 .Fl a , b , c , d , e , f , i , m
282 and
283 .Fl n
284 options are passed to
285 .Xr newfs 8
286 with the same letter;
287 the
288 .Fl O
289 option is passed to
290 .Xr newfs 8
291 as
292 .Fl o .
293 The
294 .Fl o
295 option is passed to
296 .Xr mount 8
297 with the same letter.
298 See the programs that the options are passed to for more information
299 on their semantics.
300 .Sh EXAMPLES
301 Create and mount a 32 megabyte swap-backed file system on
302 .Pa /tmp :
303 .Pp
304 .Dl "mdmfs -s 32m md /tmp"
305 .Pp
306 The same file system created as an entry in
307 .Pa /etc/fstab :
308 .Pp
309 .Dl "md /tmp mfs rw,-s32m 2 0"
310 .Pp
311 Create and mount a 16 megabyte malloc-backed file system on
312 .Pa /tmp
313 using the
314 .Pa /dev/md1
315 device;
316 furthermore,
317 do not use soft-updates on it and mount it
318 .Cm async :
319 .Pp
320 .Dl "mdmfs -M -S -o async -s 16m md1 /tmp"
321 .Pp
322 Create and mount a
323 .Xr geom_uzip 4
324 based compressed disk image:
325 .Pp
326 .Dl "mdmfs -P -F foo.uzip -oro md.uzip /tmp/"
327 .Pp
328 Mount the same image, specifying the
329 .Pa /dev/md1
330 device:
331 .Pp
332 .Dl "mdmfs -P -F foo.uzip -oro md1.uzip /tmp/"
333 .Pp
334 Configure a vnode-backed file system and mount its first partition,
335 using automatic device numbering:
336 .Pp
337 .Dl "mdmfs -P -F foo.img mds1a /tmp/"
338 .Sh COMPATIBILITY
339 The
340 .Nm
341 utility, while designed to be compatible with
342 .Xr mount_mfs 8 ,
343 can be useful by itself.
344 Since
345 .Xr mount_mfs 8
346 had some silly defaults, a
347 .Dq compatibility
348 mode is provided for the case where bug-to-bug compatibility is desired.
349 .Pp
350 Compatibility is enabled by starting
351 .Nm
352 with the name
353 .Li mount_mfs
354 or
355 .Li mfs
356 (as returned by
357 .Xr getprogname 3 ) .
358 In this mode, the following behavior, as done by
359 .Xr mount_mfs 8 ,
360 is duplicated:
361 .Bl -bullet -offset indent
362 .It
363 The file mode of
364 .Ar mount-point
365 is set by default to
366 .Li 01777
367 as if
368 .Fl p Ar 1777
369 was given on the command line.
370 .El
371 .Sh SEE ALSO
372 .Xr md 4 ,
373 .Xr fstab 5 ,
374 .Xr mdconfig 8 ,
375 .Xr mount 8 ,
376 .Xr newfs 8
377 .Sh AUTHORS
378 .An Dima Dorfman