]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - sbin/mdconfig/mdconfig.8
MFC r249526:
[FreeBSD/stable/9.git] / sbin / mdconfig / mdconfig.8
1 .\" Copyright (c) 1993 University of Utah.
2 .\" Copyright (c) 1980, 1989, 1991, 1993
3 .\"     The Regents of the University of California.  All rights reserved.
4 .\" Copyright (c) 2000
5 .\"     Poul-Henning Kamp  All rights reserved.
6 .\"
7 .\" This code is derived from software contributed to Berkeley by
8 .\" the Systems Programming Group of the University of Utah Computer
9 .\" Science Department.
10 .\"
11 .\" Redistribution and use in source and binary forms, with or without
12 .\" modification, are permitted provided that the following conditions
13 .\" are met:
14 .\" 1. Redistributions of source code must retain the above copyright
15 .\"    notice, this list of conditions and the following disclaimer.
16 .\" 2. Redistributions in binary form must reproduce the above copyright
17 .\"    notice, this list of conditions and the following disclaimer in the
18 .\"    documentation and/or other materials provided with the distribution.
19 .\" 3. All advertising materials mentioning features or use of this software
20 .\"    must display the following acknowledgement:
21 .\"     This product includes software developed by the University of
22 .\"     California, Berkeley and its contributors.
23 .\" 4. Neither the name of the University nor the names of its contributors
24 .\"    may be used to endorse or promote products derived from this software
25 .\"    without specific prior written permission.
26 .\"
27 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 .\" SUCH DAMAGE.
38 .\"
39 .\"     @(#)vnconfig.8  8.1 (Berkeley) 6/5/93
40 .\" from: src/usr.sbin/vnconfig/vnconfig.8,v 1.19 2000/12/27 15:30:29
41 .\"
42 .\" $FreeBSD$
43 .\"
44 .Dd November 3, 2012
45 .Dt MDCONFIG 8
46 .Os
47 .Sh NAME
48 .Nm mdconfig
49 .Nd configure and enable memory disks
50 .Sh SYNOPSIS
51 .Nm
52 .Fl a
53 .Fl t Ar type
54 .Op Fl n
55 .Oo Fl o Oo Cm no Oc Ns Ar option Oc ...
56 .Op Fl f Ar file
57 .Op Fl s Ar size
58 .Op Fl S Ar sectorsize
59 .Op Fl u Ar unit
60 .Op Fl x Ar sectors/track
61 .Op Fl y Ar heads/cylinder
62 .Nm
63 .Fl d
64 .Fl u Ar unit
65 .Op Fl o Oo Cm no Oc Ns Ar force
66 .Nm
67 .Fl l
68 .Op Fl n
69 .Op Fl v
70 .Op Fl u Ar unit
71 .Nm
72 .Ar file
73 .Sh DESCRIPTION
74 The
75 .Nm
76 utility configures and enables
77 .Xr md 4
78 devices.
79 .Pp
80 Options indicate an action to be performed:
81 .Bl -tag -width indent
82 .It Fl a
83 Attach a memory disk.
84 This will configure and attach a memory disk with the
85 parameters specified and attach it to the system.
86 .It Fl d
87 Detach a memory disk from the system and release all resources.
88 .It Fl t Ar type
89 Select the type of the memory disk.
90 .Bl -tag -width "malloc"
91 .It Cm malloc
92 Storage for this type of memory disk is allocated with
93 .Xr malloc 9 .
94 This limits the size to the malloc bucket limit in the kernel.
95 If the
96 .Fl o Cm reserve
97 option is not set, creating and filling a large
98 malloc-backed memory disk is a very easy way to
99 panic a system.
100 .It Cm vnode
101 A file specified with
102 .Fl f Ar file
103 becomes the backing store for this memory disk.
104 .It Cm swap
105 Storage for this type of memory disk is allocated from buffer
106 memory.
107 Pages get pushed out to swap when the system is under memory
108 pressure, otherwise they stay in the operating memory.
109 Using
110 .Cm swap
111 backing is generally preferred instead of using
112 .Cm malloc
113 backing.
114 .El
115 .It Fl f Ar file
116 Filename to use for the vnode type memory disk.
117 The
118 .Fl a
119 and
120 .Fl t Ar vnode
121 options are implied if not specified.
122 .It Fl l
123 List configured devices.
124 If given with
125 .Fl u ,
126 display details about that particular device.
127 If the
128 .Fl v
129 option is specified, show all details.
130 .It Fl n
131 When printing 
132 .Xr md 4
133 device names, print only the unit number without the
134 .Xr md 4
135 prefix.
136 .It Fl s Ar size
137 Size of the memory disk.
138 .Ar Size
139 is the number of 512 byte sectors unless suffixed with a
140 .Cm b , k , m , g ,
141 or
142 .Cm t
143 which
144 denotes byte, kilobyte, megabyte, gigabyte and terabyte respectively.
145 The
146 .Fl a
147 and
148 .Fl t Ar swap
149 options are implied if not specified.
150 .It Fl S Ar sectorsize
151 Sectorsize to use for the memory disk, in bytes.
152 .It Fl x Ar sectors/track
153 See the description of the
154 .Fl y
155 option below.
156 .It Fl y Ar heads/cylinder
157 For
158 .Cm malloc
159 or
160 .Cm vnode
161 backed devices, the
162 .Fl x
163 and
164 .Fl y
165 options can be used to specify a synthetic geometry.
166 This is useful for constructing bootable images for later download to
167 other devices.
168 .It Fl o Oo Cm no Oc Ns Ar option
169 Set or reset options.
170 .Bl -tag -width indent
171 .It Oo Cm no Oc Ns Cm async
172 For
173 .Cm vnode
174 backed devices: avoid
175 .Dv IO_SYNC
176 for increased performance but
177 at the risk of deadlocking the entire kernel.
178 .It Oo Cm no Oc Ns Cm reserve
179 Allocate and reserve all needed storage from the start, rather than as needed.
180 .It Oo Cm no Oc Ns Cm cluster
181 Enable clustering on this disk.
182 .It Oo Cm no Oc Ns Cm compress
183 Enable/disable compression features to reduce memory usage.
184 .It Oo Cm no Oc Ns Cm force
185 Disable/enable extra sanity checks to prevent the user from doing something
186 that might adversely affect the system.
187 .It Oo Cm no Oc Ns Cm readonly
188 Enable/disable readonly mode.
189 .El
190 .It Fl u Ar unit
191 Request a specific unit number for the
192 .Xr md 4
193 device instead of automatic allocation.
194 .El
195 .Pp
196 The last form,
197 .Nm
198 .Ar file ,
199 is provided for convenience as an abbreviation of
200 .Nm
201 .Fl a
202 .Fl t Ar vnode
203 .Fl f Ar file .
204 .Sh EXAMPLES
205 Create a 4 megabyte
206 .Xr malloc 9
207 backed memory disk.
208 The name of the allocated unit will be printed on stdout, such as
209 .Dq Li md3 :
210 .Pp
211 .Dl mdconfig -a -t malloc -s 4m
212 .Pp
213 Create a disk named
214 .Pa /dev/md4
215 with
216 .Pa /tmp/boot.flp
217 as backing storage:
218 .Pp
219 .Dl mdconfig -a -t vnode -f /tmp/boot.flp -u 4
220 .Pp
221 Detach and free all resources used by
222 .Pa /dev/md4 :
223 .Pp
224 .Dl mdconfig -d -u 4
225 .Pp
226 Create a 128MByte swap backed disk, initialize an
227 .Xr ffs 7
228 file system on it, and mount it on
229 .Pa /tmp :
230 .Bd -literal -offset indent
231 mdconfig -a -t swap -s 128M -u 10
232 newfs -U /dev/md10
233 mount /dev/md10 /tmp
234 chmod 1777 /tmp
235 .Ed
236 .Pp
237 Create a 5MB file-backed disk
238 .Ns ( Fl a
239 and
240 .Fl t Ar vnode
241 are implied):
242 .Bd -literal -offset indent
243 dd if=/dev/zero of=somebackingfile bs=1k count=5k
244 mdconfig -f somebackingfile -u 0
245 bsdlabel -w md0 auto
246 newfs md0c
247 mount /dev/md0c /mnt
248 .Ed
249 .Pp
250 Create an
251 .Xr md 4
252 device out of an ISO 9660 CD image file
253 .Ns ( Fl a
254 and
255 .Fl t Ar vnode
256 are implied), using the first available
257 .Xr md 4
258 device, and then mount the new memory disk:
259 .Bd -literal -offset indent
260 mount -t cd9660 /dev/`mdconfig -f cdimage.iso` /mnt
261 .Pp
262 .Ed
263 Create a file-backed device from a hard disk image that begins
264 with 512K of raw header information.
265 .Xr gnop 8
266 is used to skip over the header information, positioning
267 .Pa md1.nop
268 to the start of the filesystem in the image.
269 .Bd -literal -offset indent
270 mdconfig -f diskimage.img -u 1
271 gnop create -o 512K md1
272 mount /dev/md1.nop /mnt
273 .Ed
274 .Sh SEE ALSO
275 .Xr md 4 ,
276 .Xr ffs 7 ,
277 .Xr bsdlabel 8 ,
278 .Xr fdisk 8 ,
279 .Xr mdmfs 8 ,
280 .Xr malloc 9
281 .Sh HISTORY
282 The
283 .Nm
284 utility first appeared in
285 .Fx 5.0
286 as a cleaner replacement for the
287 .Xr vn 4
288 and
289 .Xr vnconfig 8
290 combo.
291 .Sh AUTHORS
292 The
293 .Nm
294 utility was written by
295 .An Poul-Henning Kamp
296 .Aq phk@FreeBSD.org .