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