]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - sbin/mdconfig/mdconfig.8
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.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 June 21, 2008
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/cyl
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 .Sh DESCRIPTION
72 The
73 .Nm
74 utility configures and enables
75 .Xr md 4
76 devices.
77 .Pp
78 Options indicate an action to be performed:
79 .Bl -tag -width indent
80 .It Fl a
81 Attach a memory disk.
82 This will configure and attach a memory disk with the
83 parameters specified and attach it to the system.
84 .It Fl d
85 Detach a memory disk from the system and release all resources.
86 .It Fl t Ar type
87 Select the type of the memory disk.
88 .Bl -tag -width "preload"
89 .It Cm malloc
90 Storage for this type of memory disk is allocated with
91 .Xr malloc 9 .
92 This limits the size to the malloc bucket limit in the kernel.
93 If the
94 .Fl o Cm reserve
95 option is not set, creating and filling a large
96 malloc-backed memory disk is a very easy way to
97 panic a system.
98 .It Cm vnode
99 A file specified with
100 .Fl f Ar file
101 becomes the backing store for this memory disk.
102 .It Cm swap
103 Storage for this type of memory disk is allocated from buffer
104 memory.
105 Pages get pushed out to the swap when the system is under memory
106 pressure, otherwise they stay in the operating memory.
107 Using
108 .Cm swap
109 backing is generally preferable over
110 .Cm malloc
111 backing.
112 .El
113 .It Fl f Ar file
114 Filename to use for the vnode type memory disk. Options
115 .Fl a
116 and
117 .Fl t Ar vnode
118 are implied if not specified.
119 .It Fl l
120 List configured devices.
121 If given with
122 .Fl u ,
123 display details about that particular device.
124 If
125 .Fl v
126 option specified, show all details.
127 .It Fl n
128 When printing md device names, print only the unit number without the
129 md prefix.
130 .It Fl s Ar size
131 Size of the memory disk.
132 .Ar Size
133 is the number of 512 byte sectors unless suffixed with a
134 .Cm b , k , m , g ,
135 or
136 .Cm t
137 which
138 denotes byte, kilobyte, megabyte, gigabyte and terabyte respectively. Options
139 .Fl a
140 and
141 .Fl t Ar swap
142 are implied if not specified.
143 .It Fl S Ar sectorsize
144 Sectorsize to use for malloc backed device.
145 .It Fl x Ar sectors/track
146 See the description of the
147 .Fl y
148 option below.
149 .It Fl y Ar heads/cylinder
150 For
151 .Cm malloc
152 or
153 .Cm vnode
154 backed devices, the
155 .Fl x
156 and
157 .Fl y
158 options can be used to specify a synthetic geometry.
159 This is useful for constructing bootable images for later download to
160 other devices.
161 .It Fl o Oo Cm no Oc Ns Ar option
162 Set or reset options.
163 .Bl -tag -width indent
164 .It Oo Cm no Oc Ns Cm async
165 For
166 .Cm vnode
167 backed devices: avoid
168 .Dv IO_SYNC
169 for increased performance but
170 at the risk of deadlocking the entire kernel.
171 .It Oo Cm no Oc Ns Cm reserve
172 Allocate and reserve all needed storage from the start, rather than as needed.
173 .It Oo Cm no Oc Ns Cm cluster
174 Enable clustering on this disk.
175 .It Oo Cm no Oc Ns Cm compress
176 Enable/Disable compression features to reduce memory usage.
177 .It Oo Cm no Oc Ns Cm force
178 Disable/Enable extra sanity checks to prevent the user from doing something
179 that might adversely affect the system.
180 .It Oo Cm no Oc Ns Cm readonly
181 Enable/Disable readonly mode.
182 .El
183 .It Fl u Ar unit
184 Request a specific unit number for the
185 .Xr md 4
186 device instead of automatic allocation.
187 .El
188 .Sh EXAMPLES
189 To create a 4 megabyte
190 .Xr malloc 9
191 backed memory disk.
192 The name of the allocated unit will be output on stdout like
193 .Dq Li md3 :
194 .Pp
195 .Dl mdconfig -a -t malloc -s 4m
196 .Pp
197 To create a disk named
198 .Pa /dev/md4
199 with
200 .Pa /tmp/boot.flp
201 as backing storage:
202 .Pp
203 .Dl mdconfig -a -t vnode -f /tmp/boot.flp -u 4
204 .Pp
205 To detach and free all resources used by
206 .Pa /dev/md4 :
207 .Pp
208 .Dl mdconfig -d -u 4
209 .Pp
210 To create a 128MByte swap backed disk, initialize an
211 .Xr ffs 7
212 file system on it, and mount it on
213 .Pa /tmp :
214 .Bd -literal -offset indent
215 mdconfig -a -t swap -s 128M -u 10
216 newfs -U /dev/md10
217 mount /dev/md10 /tmp
218 chmod 1777 /tmp
219 .Ed
220 .Pp
221 To create a 5MB file-backed disk
222 .Ns ( Fl a
223 and
224 .Fl t Ar vnode
225 are implied):
226 .Bd -literal -offset indent
227 dd if=/dev/zero of=somebackingfile bs=1k count=5k
228 mdconfig -f somebackingfile -u 0
229 bsdlabel -w md0 auto
230 newfs md0c
231 mount /dev/md0c /mnt
232 .Ed
233 .Pp
234 To create an
235 .Xr md 4
236 device out of an ISO 9660 CD image file
237 .Ns ( Fl a
238 and
239 .Fl t Ar vnode
240 are implied), using the first available
241 .Xr md 4
242 device, and then mount the new memory disk:
243 .Bd -literal -offset indent
244 mount -t cd9660 /dev/`mdconfig -f cdimage.iso` /mnt
245 .Ed
246 .Sh SEE ALSO
247 .Xr md 4 ,
248 .Xr ffs 7 ,
249 .Xr bsdlabel 8 ,
250 .Xr fdisk 8 ,
251 .Xr mdmfs 8 ,
252 .Xr malloc 9
253 .Sh HISTORY
254 The
255 .Nm
256 utility first appeared in
257 .Fx 5.0
258 as a cleaner replacement for the
259 .Xr vn 4
260 and
261 .Xr vnconfig 8
262 combo.
263 .Sh AUTHORS
264 The
265 .Nm
266 utility was written by
267 .An Poul-Henning Kamp
268 .Aq phk@FreeBSD.org .