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