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