]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sbin/mdmfs/mdmfs.8
Merge branch 'releng/11.3' into releng-CDN/11.3
[FreeBSD/FreeBSD.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 September 9, 2017
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 or the
37 .Xr tmpfs 5
38 filesystem
39 .Sh SYNOPSIS
40 .Nm
41 .Op Fl DLlMNnPStTUX
42 .Op Fl a Ar maxcontig
43 .Op Fl b Ar block-size
44 .Op Fl c Ar blocks-per-cylinder-group
45 .Op Fl d Ar max-extent-size
46 .Op Fl E Ar path-mdconfig
47 .Op Fl e Ar maxbpg
48 .Op Fl F Ar file
49 .Op Fl f Ar frag-size
50 .Op Fl i Ar bytes
51 .Op Fl m Ar percent-free
52 .Op Fl O Ar optimization
53 .Op Fl o Ar mount-options
54 .Op Fl p Ar permissions
55 .Op Fl s Ar size
56 .Op Fl T Ar fstype
57 .Op Fl v Ar version
58 .Op Fl w Ar user : Ns Ar group
59 .Ar md-device
60 .Ar mount-point
61 .Sh DESCRIPTION
62 The
63 .Nm
64 utility is designed to be a work-alike and look-alike of the deprecated
65 .Xr mount_mfs 8 .
66 The end result is essentially the same,
67 but is accomplished in a completely different way.
68 Based on
69 .Ar md-device ,
70 the
71 .Nm
72 utility either creates a 
73 .Xr tmpfs 5
74 filesystem, or it configures an
75 .Xr md 4
76 disk using
77 .Xr mdconfig 8 ,
78 puts a UFS file system on it (unless
79 .Fl P
80 was specified) using
81 .Xr newfs 8 ,
82 and mounts it using
83 .Xr mount 8 .
84 It can handle
85 .Xr geom_uzip 4
86 compressed disk images, as long as the kernel supports this GEOM class.
87 All the command line options are passed to the appropriate program
88 at the appropriate stage in order to achieve the desired effect.
89 .Pp
90 When
91 .Ar md-device
92 is `auto',
93 .Nm
94 uses
95 .Xr tmpfs 5
96 if it is present in the kernel or can be loaded as a module,
97 otherwise it falls back to using
98 .Xr md 4
99 auto-unit as if `md' had been specified.
100 .Pp
101 When
102 .Ar md-device
103 is `tmpfs',
104 .Nm
105 mounts a
106 .Xr tmpfs 5
107 filesystem, translating the
108 .Fl s
109 size option, if present, into a `-o size=' mount option.
110 Any
111 .Fl o
112 options on the command line are passed through to the
113 .Xr tmpfs 5
114 mount.
115 Options specific to
116 .Xr mdconfig 8
117 or
118 .Xr newfs 8
119 are ignored.
120 .Pp
121 When
122 .Ar md-device
123 does not result in
124 .Xr tmpfs 5
125 being used, then an
126 .Xr md 4
127 device is configured instead.
128 By default,
129 .Nm
130 creates a swap-based
131 .Pq Dv MD_SWAP
132 disk with soft-updates enabled
133 and mounts it on
134 .Ar mount-point .
135 It uses the
136 .Xr md 4
137 device specified by
138 .Ar md-device .
139 If
140 .Ar md-device
141 is
142 .Ql md
143 (no unit number),
144 it will use
145 .Xr md 4 Ns 's
146 auto-unit feature to automatically select an unused device.
147 Unless otherwise specified with one of the options below,
148 it uses the default arguments to all the helper programs.
149 .Pp
150 The following options are available.
151 Where possible,
152 the option letter matches the one used by
153 .Xr mount_mfs 8
154 for the same thing.
155 .Bl -tag -width indent
156 .It Fl a Ar maxcontig
157 Specify the maximum number of contiguous blocks that will be laid
158 out before forcing a rotational delay
159 (see the
160 .Fl d
161 option).
162 .It Fl b Ar block-size
163 The block size of the file system, in bytes.
164 .It Fl c Ar blocks-per-cylinder-group
165 The number of blocks per cylinder group in the file system.
166 .It Fl D
167 If not using auto-unit,
168 do not run
169 .Xr mdconfig 8
170 to try to detach the unit before attaching it.
171 .It Fl d Ar max-extent-size
172 The file system may choose to store large files using extents.
173 This parameter specifies the largest extent size that may be
174 used.  It is presently limited to its default value which is 16
175 times the file system blocksize.
176 .It Fl E Ar path-mdconfig
177 Use
178 .Ar path-mdconfig
179 as a location of the
180 .Xr mdconfig 8
181 utility.
182 .It Fl e Ar maxbpg
183 Indicate the maximum number of blocks any single file can allocate
184 out of a cylinder group before it is forced to begin allocating
185 blocks from another cylinder group.
186 .It Fl F Ar file
187 Create a vnode-backed
188 .Pq Dv MD_VNODE
189 memory disk backed by
190 .Ar file .
191 .It Fl f Ar frag-size
192 The fragment size of the file system in bytes.
193 .It Fl i Ar bytes
194 Number of bytes per inode.
195 .It Fl l
196 Enable multilabel MAC on the new file system.
197 .It Fl L
198 Show the output of the helper programs.
199 By default,
200 it is sent to
201 .Pa /dev/null .
202 .It Fl M
203 Create a
204 .Xr malloc 9
205 backed disk
206 .Pq Dv MD_MALLOC
207 instead of a swap-backed disk.
208 .It Fl m Ar percent-free
209 The percentage of space reserved for the superuser.
210 .It Fl N
211 Do not actually run the helper programs.
212 This is most useful in conjunction with
213 .Fl X .
214 .It Fl n
215 Do not create a
216 .Pa .snap
217 directory on the new file system.
218 .It Fl O Ar optimization
219 Select the optimization preference;
220 valid choices are
221 .Cm space
222 and
223 .Cm time ,
224 which will optimize for minimum space fragmentation and
225 minimum time spent allocating blocks,
226 respectively.
227 .It Fl o Ar mount-options
228 Specify the mount options with which to mount the file system.
229 See
230 .Xr mount 8
231 for more information.
232 .It Fl P
233 Preserve the existing file system;
234 do not run
235 .Xr newfs 8 .
236 This only makes sense if
237 .Fl F
238 is specified to create a vnode-backed disk.
239 .It Fl p Ar permissions
240 Set the file (directory) permissions of the mount point
241 .Ar mount-point
242 to
243 .Ar permissions .
244 The
245 .Ar permissions
246 argument can be in any of the mode formats recognized by
247 .Xr chmod 1 .
248 If symbolic permissions are specified,
249 the operation characters
250 .Dq +
251 and
252 .Dq -
253 are interpreted relative to the initial permissions of
254 .Dq a=rwx .
255 .It Fl S
256 Do not enable soft-updates on the file system.
257 .It Fl s Ar size
258 Specify the size of the disk to create.
259 This only makes sense if
260 .Fl F
261 is
262 .Em not
263 specified.
264 That is,
265 this will work when the backing storage is some form of
266 memory, as opposed to a fixed-size file.
267 The size may include the usual SI suffixes (k, m, g, t, p).
268 A number without a suffix is interpreted as a count of 512-byte sectors.
269 .It Fl t
270 Turn on the TRIM enable flag for
271 .Xr newfs 8 .
272 When used with a file system that issue BIO_DELETE bio requests,
273 .Xr md 4
274 returns deleted blocks to the system memory pool.
275 .It Fl T Ar fstype
276 Specify a file system type for a vnode-backed memory disk.
277 Any file system supported by
278 .Xr mount 8
279 command can be specified.
280 This option only makes sense when
281 .Fl F
282 and
283 .Fl P
284 are used.
285 .It Fl U
286 Enable soft-updates on the file system.
287 This is the default, and is accepted only
288 for compatibility.
289 It is only really useful to negate the
290 .Fl S
291 flag, should such a need occur.
292 .It Fl v Ar version
293 Specify the UFS version number for use on the file system; it may be
294 either
295 .Dv 1
296 or
297 .Dv 2 .
298 The default is derived from the default of the
299 .Xr newfs 8
300 command.
301 .It Fl w Ar user : Ns Ar group
302 Set the owner and group to
303 .Ar user
304 and
305 .Ar group ,
306 respectively.
307 The arguments have the same semantics as with
308 .Xr chown 8 ,
309 but specifying just a
310 .Ar user
311 or just a
312 .Ar group
313 is not supported.
314 .It Fl X
315 Print what command will be run before running it, and
316 other assorted debugging information.
317 .El
318 .Pp
319 The
320 .Fl F
321 and
322 .Fl s
323 options are passed to
324 .Xr mdconfig 8
325 as
326 .Fl f
327 and
328 .Fl s ,
329 respectively.
330 The
331 .Fl a , b , c , d , e , f , i , m
332 and
333 .Fl n
334 options are passed to
335 .Xr newfs 8
336 with the same letter.
337 The
338 .Fl O
339 option is passed to
340 .Xr newfs 8
341 as
342 .Fl o .
343 The
344 .Fl o
345 option is passed to
346 .Xr mount 8
347 with the same letter.
348 The
349 .Fl T
350 option is passed to
351 .Xr mount 8
352 as
353 .Fl t .
354 See the programs that the options are passed to for more information
355 on their semantics.
356 .Sh EXAMPLES
357 Create and mount a 32 megabyte swap-backed file system on
358 .Pa /tmp :
359 .Pp
360 .Dl "mdmfs -s 32m md /tmp"
361 .Pp
362 The same file system created as an entry in
363 .Pa /etc/fstab :
364 .Pp
365 .Dl "md /tmp mfs rw,-s32m 2 0"
366 .Pp
367 Create and mount a 16 megabyte malloc-backed file system on
368 .Pa /tmp
369 using the
370 .Pa /dev/md1
371 device;
372 furthermore,
373 do not use soft-updates on it and mount it
374 .Cm async :
375 .Pp
376 .Dl "mdmfs -M -S -o async -s 16m md1 /tmp"
377 .Pp
378 Create and mount a
379 .Xr geom_uzip 4
380 based compressed disk image:
381 .Pp
382 .Dl "mdmfs -P -F foo.uzip -oro md.uzip /tmp/"
383 .Pp
384 Mount the same image, specifying the
385 .Pa /dev/md1
386 device:
387 .Pp
388 .Dl "mdmfs -P -F foo.uzip -oro md1.uzip /tmp/"
389 .Pp
390 Configure a vnode-backed file system and mount its first partition,
391 using automatic device numbering:
392 .Pp
393 .Dl "mdmfs -P -F foo.img mds1a /tmp/"
394 .Pp
395 Mount a vnode-backed cd9660 file system using automatic device numbering:
396 .Pp
397 .Dl "mdmfs -T cd9660 -P -F foo.iso md /tmp"
398 .Sh COMPATIBILITY
399 The
400 .Nm
401 utility, while designed to be compatible with
402 .Xr mount_mfs 8 ,
403 can be useful by itself.
404 Since
405 .Xr mount_mfs 8
406 had some silly defaults, a
407 .Dq compatibility
408 mode is provided for the case where bug-to-bug compatibility is desired.
409 .Pp
410 Compatibility is enabled by starting
411 .Nm
412 with the name
413 .Li mount_mfs
414 or
415 .Li mfs
416 (as returned by
417 .Xr getprogname 3 ) .
418 In this mode, the following behavior, as done by
419 .Xr mount_mfs 8 ,
420 is duplicated:
421 .Bl -bullet -offset indent
422 .It
423 The file mode of
424 .Ar mount-point
425 is set by default to
426 .Li 01777
427 as if
428 .Fl p Ar 1777
429 was given on the command line.
430 .El
431 .Sh SEE ALSO
432 .Xr md 4 ,
433 .Xr fstab 5 ,
434 .Xr tmpfs 5 ,
435 .Xr mdconfig 8 ,
436 .Xr mount 8 ,
437 .Xr newfs 8
438 .Sh AUTHORS
439 .An Dima Dorfman