]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.sbin/vnconfig/vnconfig.8
mdoc(7) police: split punctuation characters + misc fixes.
[FreeBSD/FreeBSD.git] / usr.sbin / vnconfig / vnconfig.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 .\"
5 .\" This code is derived from software contributed to Berkeley by
6 .\" the Systems Programming Group of the University of Utah Computer
7 .\" Science Department.
8 .\"
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
11 .\" are met:
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\"    notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\"    notice, this list of conditions and the following disclaimer in the
16 .\"    documentation and/or other materials provided with the distribution.
17 .\" 3. All advertising materials mentioning features or use of this software
18 .\"    must display the following acknowledgement:
19 .\"     This product includes software developed by the University of
20 .\"     California, Berkeley and its contributors.
21 .\" 4. Neither the name of the University nor the names of its contributors
22 .\"    may be used to endorse or promote products derived from this software
23 .\"    without specific prior written permission.
24 .\"
25 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 .\" SUCH DAMAGE.
36 .\"
37 .\"     @(#)vnconfig.8  8.1 (Berkeley) 6/5/93
38 .\" $FreeBSD$
39 .\"
40 .Dd July 8, 1993
41 .Dt VNCONFIG 8
42 .Os BSD 4
43 .Sh NAME
44 .Nm vnconfig
45 .Nd configure and enable vnode disks
46 .Sh SYNOPSIS
47 .Nm
48 .Op Fl cdeguv
49 .Oo Fl s Ar option Ns
50 .Op , Ns Ar option Ns Ar ... Oc
51 .Oo Fl r Ar option Ns
52 .Op , Ns Ar option Ns Ar ... Oc
53 .Op Fl S Ar value
54 .Ar special_file Op Ar regular_file
55 .Op Ar feature
56 .Nm
57 .Fl a 
58 .Op Fl cdeguv
59 .Op Fl s Ar option
60 .Op Fl r Ar option
61 .Op Fl f Ar config_file
62 .Sh WARNING
63 .Nm
64 is being phased out.
65 Please use
66 .Xr mdconfig 8
67 instead.
68 .Sh DESCRIPTION
69 The
70 .Nm
71 command configures and enables vnode pseudo disk devices.
72 The first form of the command will associate the special file 
73 .Ar special_file
74 with the regular file
75 .Ar regular_file
76 allowing the latter to be accessed as though it were a disk.
77 Hence a regular file within the filesystem can be used for swapping
78 or can contain a filesystem that is mounted in the name space.  If you
79 want to use swap backing store for your device instead of a file, you
80 can leave regular_file out and specify the size of the block device
81 with the -S option.
82 .Pp
83 Options indicate an action to be performed:
84 .Bl -tag -width indent
85 .It Fl a
86 Read a command file and performs the
87 specified actions for each device/file pair.
88 .It Fl c
89 Configure the device.
90 If successful, references to
91 .Ar special_file
92 will access the contents of
93 .Ar regular_file .
94 .It Fl d
95 Disable (if possible) the specified feature.
96 .It Fl e
97 Configure the device and enables any
98 .Ar feature
99 that was specified.
100 If no feature was specified,
101 .Fl e
102 is the same as
103 .Fl c .
104 .It Fl f Ar config_file
105 Use
106 .Ar config_file
107 as an alternate config file.
108 .It Fl g
109 Fiddle global options. 
110 .It Fl r Ar flag
111 Reset
112 .Ar flag .
113 The list of allowed flags and their meanings are:
114 .Bl -tag -width "follow"
115 .It Ar reserve 
116 Pre-reserve the blocks underlying the file or swap backing store.  Currently only
117 works for swap backing store.  This option also disables on-the-fly freeing of 
118 the underlying backing store (for example, when you remove a large file). 
119 Use this option if you wish to avoid long-term fragmentation of the backing
120 store.  Also note that when this option is used, the initial contents of the
121 backing store may contain garbage rather then zeros.  It may even be possible to
122 recover the prior contents of a swap-backed VN across a reboot if the VN device
123 is configured before any swap is allocated by the system.
124 .It Ar follow 
125 debug flow in the 
126 .Xr vn 4
127 driver.
128 .It Ar debug 
129 debug data in the
130 .Xr vn 4
131 driver.
132 .It Ar io 
133 debug I/O in the
134 .Xr vn 4
135 driver.
136 .It Ar all 
137 turn on all flags.
138 .It Ar none
139 turn off all flags.
140 .El
141 .It Fl s Ar flag
142 Set
143 .Ar flag .
144 The list of allowed flags and their meanings are the same as for the
145 .Fl r
146 option.
147 .It Fl S Xo
148 .Sm off
149 .Ar value
150 .Es \&{ \&}
151 .En Cm k , m , g , t
152 .Sm on
153 .Xc
154 If no regular file is specified, VN will use swap for backing store.
155 This option specifies the size of the device and implies the
156 .Fl c
157 option.
158 For example, '23m' for
159 23 megabytes.  The VN device will round the size up to a machine page boundary.
160 Filesystems up to 7.9 terabytes are supported.  When specified along with
161 a regular file, this option overrides the regular file's size insofar as
162 VN is concerned.
163 .It Fl T
164 When a regular file is specified, VN will ftruncate() the file to 0 first.
165 Normally you should also specify the -S option to set the size of the file.
166 This option also creates the file if it did not previously exist.
167 This option is only meaningful if the -S option has been specified.
168 .It Fl Z
169 When a regular file is specified, VN will zero the contents of the file to
170 ensure that all blocks have been allocated by the filesystem.  This option is
171 only meaningful if the -S option has been specified.
172 .It Fl u
173 Disable and ``unconfigure'' the device.
174 .It Fl v
175 Print messages to stdout describing actions taken.
176 .El
177 .Pp
178 If no action option is given,
179 .Fl c
180 is assumed.
181 .Pp
182 The
183 .Ar feature
184 argument specifies a feature that can be enabled via the
185 .Fl e
186 option:
187 .Bl -tag -width indent
188 .It Dv swap
189 Swapping is enabled on the special file.
190 See
191 .Xr swapon 2 .
192 .It Dv Pf mountro= Pa mount_point
193 The special file is mounted read-only on
194 .Ar mount_point .
195 See
196 .Xr mount 2 .
197 .It Dv Pf mountrw= Pa mount_point
198 The special file is mounted read-write on
199 .Ar mount_point .
200 See
201 .Xr mount 2 .
202 .It Dv Pf mount= Pa mount_point
203 Same as ``mountrw=''.
204 .El
205 .Pp
206 A configuration file contains one line per device/file pair in the form:
207 .Bd -literal
208         special_file    regular_file    [ feature ]
209 .Ed
210 .Pp
211 where fields are separated by white space.
212 The previously described action options serve to configure, enable,
213 disable or unconfigure all devices in the configuration file.
214 .Sh FILES
215 .Bl -tag -width /etc/vntab -compact
216 .It Pa /etc/vntab
217 default configuration file for
218 .Fl a
219 option
220 .El
221 .Sh EXAMPLES
222 .Pp
223 .Dl vnconfig vn0c /tmp/diskimage
224 .Pp
225 Configures the vnode disk
226 .Pa vn0c .
227 .Pp
228 .Dl vnconfig -e vn0c /var/swapfile swap
229 .Pp
230 Configures
231 .Pa vn0c
232 and enables swapping on it.
233 .Pp
234 .Dl vnconfig -d vn0c myfilesystem mount=/mnt
235 .Pp
236 Unmounts (disables)
237 .Pa vn0c .
238 .Pp
239 .Dl vnconfig -ae
240 .Pp
241 Configures and enables all devices specified in
242 .Pa /etc/vntab .
243 .Pp
244 .Dl vnconfig -c vn0 somebackingfile
245 .Dl disklabel -r -w vn0 auto
246 .Dl disklabel -e vn0
247 .Pp
248 Is an example of how to configure a file-backed VN disk with a disk label 
249 and to initialize and then edit the label.  Once you create the label, you
250 can partition your VN disk and, for example, create a filesystem on one of
251 the partitions.  If you are using a file as backing store, it may be possible
252 to recover your VN disk after a crash by vnconfig'ing the same file again
253 and using the VN configuration already stored in the file rather then 
254 relabeling and recreating the filesystem.  It is even possible to fsck the
255 VN partitions that previously contained filesystems.
256 .Pp
257 .Dl vnconfig -e -s reserve -S 400m vn1
258 .Dl disklabel -r -w vn1 auto
259 .Dl newfs /dev/vn1c
260 .Dl mount /dev/vn1c /usr/obj
261 .Pp
262 Is an example of a swap-backed VN disk configuration.  This example assumes
263 that you have at least 400 megabytes of swap free (and hopefully much more).
264 The swap space is pre-reserved in order to maintain maximum performance.
265 We then label the disk, newfs it, and mount it as /usr/obj.  Swap-backed VN
266 devices are recoverable after a crash if you (A) use the reserve flag, and if
267 (B) the same swap is reserved as was the last time, meaning that such 
268 vnconfig's would have to be run in your rc.local.  In general, though, you
269 only use swap-backed VN devices to hold information you don't mind losing
270 on every reboot.
271 .Sh SEE ALSO
272 .Xr mount 2 ,
273 .Xr swapon 2 ,
274 .Xr unmount 2 ,
275 .Xr vn 4