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