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