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.
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.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
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.
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
37 .\" @(#)vnconfig.8 8.1 (Berkeley) 6/5/93
38 .\" $FreeBSD: src/usr.sbin/vnconfig/vnconfig.8,v 1.14.2.8 2003/01/04 22:35:53 keramida Exp $
39 .\" $DragonFly: src/usr.sbin/vnconfig/vnconfig.8,v 1.10 2008/07/27 22:36:01 thomas Exp $
41 .Dd September 28, 2009
46 .Nd configure and enable vnode disks
53 .Ar special_file Op Ar regular_file
60 .Op Fl f Ar config_file
63 .Op Ar special_file Ar ...
67 command configures, enables and lists vnode pseudo disk devices.
68 The first form of the command will associate the special file
72 allowing the latter to be accessed as though it were a disk.
73 Hence a regular file within the filesystem can be used for swapping
74 or can contain a filesystem that is mounted in the name space.
75 If you want to use swap backing store for your device instead of a file,
78 out and specify the size of the block device
83 Options indicate an action to be performed:
84 .Bl -tag -width indent
86 Read a command file and performs the
87 specified actions for each device/file pair.
90 If successful, references to
92 will access the contents of
97 device is autocloned if
101 the name of the resulting device is printed on stdout.
103 Disable (if possible) the specified feature.
105 Configure the device and enables any
108 If no feature was specified,
112 .It Fl f Ar config_file
113 Specify configuration file.
117 Fiddle global options.
118 .It Fl l Ar special_file Ar ...
121 devices and indicate which ones are in use.
124 list is given, only those devices will be described.
128 which is a comma separated string of options.
129 The list of allowed options and their meanings are:
130 .Bl -tag -width "reserve"
132 Pre-reserve the blocks underlying the file or swap backing store.
133 Currently only works for swap backing store.
134 This option also disables on-the-fly freeing of
135 the underlying backing store (for example, when you remove a large file).
136 Use this option if you wish to avoid long-term fragmentation of the backing
138 Also note that when this option is used, the initial contents of the
139 backing store may contain garbage rather than zeros.
140 It may even be possible to
141 recover the prior contents of a swap-backed
143 across a reboot if the
146 is configured before any swap is allocated by the system.
164 Turn off all options.
169 which is a comma separated string of options.
170 The list of allowed options and their meanings are the same as for the
180 If no regular file is specified,
182 will use swap for backing store.
183 This option specifies the size of the device.
188 In the absence of a size modifier,
193 device will round the size up to a machine page boundary.
194 Filesystems up to 7.9 terabytes are supported.
195 When specified along with
196 a regular file, this option overrides the regular file's size insofar as
200 When a regular file is specified,
204 the file to length 0 first.
205 Normally you should also specify the
207 option to set the size of the file.
208 This option also creates the file if it did not previously exist.
209 This option is only meaningful if the
211 option has been specified.
213 When a regular file is specified,
215 will zero the contents of the file to
216 ensure that all blocks have been allocated by the filesystem.
217 This option is only meaningful if the
219 option has been specified.
221 Disable and ``unconfigure'' the device.
223 Print messages to stdout describing actions taken.
226 If no action option is given,
232 argument specifies a feature that can be enabled via the
235 .Bl -tag -width indent
237 Swapping is enabled on the special file.
240 .It Cm mountro= Ns Ar mount_point
241 The special file is mounted read-only on
245 .It Cm mountrw= Ns Ar mount_point
246 The special file is mounted read-write on
250 .It Cm mount= Ns Ar mount_point
252 .Cm mountrw= Ns Ar mount_point .
255 A configuration file contains one line per device/file pair in the form:
257 special_file regular_file [feature]
260 where fields are separated by white space.
261 The previously described action options serve to configure, enable,
262 disable or unconfigure all devices in the configuration file.
264 .Bl -tag -width /etc/vntab -compact
266 default configuration file for
271 .Dl vnconfig vn /tmp/diskimage
273 Configures an autocloned vnode disk,
274 the name of the resulting device is printed, e.g.\&
277 .Dl vnconfig vn0 /tmp/diskimage
279 Configures the vnode disk
282 .Dl vnconfig -e vn0 /var/swapfile swap
286 and enables swapping on it.
288 .Dl vnconfig -c -v /dev/vn0 cdimage.iso
289 .Dl mount -t cd9660 -o ro /dev/vn0 /mnt
291 Mount an ISO9660 CD image file.
296 Unmount the CD image file.
298 .Dl vnconfig -d vn0 myfilesystem mount=/mnt
305 Configures and enables all devices specified in
308 .Dl vnconfig -c vn0 somebackingfile
309 .Dl disklabel -r -w vn0s0 auto
310 .Dl disklabel -e vn0s0
312 Is an example of how to configure a file-backed
314 disk with a disk label
315 and to initialize and then edit the label.
316 Once you create the label, you
319 disk and, for example, create a filesystem on one of the partitions.
320 If you are using a file as backing store, it may be possible
323 disk after a crash by
325 the same file again and using the
327 configuration already stored in the file rather than
328 relabeling and recreating the filesystem.
329 It is even possible to
333 partitions that previously contained filesystems.
335 .Dl vnconfig -e -s reserve -S 400m vn1
336 .Dl disklabel -r -w vn1s0 auto
338 .Dl mount /dev/vn1s0 /usr/obj
340 Is an example of a swap-backed
344 that you have at least 400 megabytes of swap free (and hopefully much more).
345 The swap space is pre-reserved in order to maintain maximum performance.
346 We then label the disk, newfs it, and mount it as
350 devices are recoverable after a crash if you (A) use the
353 (B) the same swap is reserved as was the last time, meaning that such
355 would have to be run in your
357 In general, though, you only use swap-backed
359 devices to hold information you don't mind losing on every reboot.