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