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