xref: /dragonfly/usr.sbin/vnconfig/vnconfig.8 (revision b7367ef6)
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: 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.5 2007/08/10 18:28:27 swildner Exp $
40.\"
41.Dd July 8, 1993
42.Dt VNCONFIG 8
43.Os
44.Sh NAME
45.Nm vnconfig
46.Nd configure and enable vnode disks
47.Sh SYNOPSIS
48.Nm
49.Op Fl cdeguvTZ
50.Oo Fl s Ar option Ns
51.Op , Ns Ar option Ns Ar ... Oc
52.Oo Fl r Ar option Ns
53.Op , Ns Ar option Ns Ar ... Oc
54.Op Fl S Ar value
55.Ar special_file Op Ar regular_file
56.Op Ar feature
57.Nm
58.Fl a
59.Op Fl cdeguv
60.Op Fl s Ar option
61.Op Fl r Ar option
62.Op Fl f Ar config_file
63.Sh DESCRIPTION
64The
65.Nm
66command configures and enables vnode pseudo disk devices.
67The first form of the command will associate the special file
68.Ar special_file
69with the regular file
70.Ar regular_file
71allowing the latter to be accessed as though it were a disk.
72Hence a regular file within the filesystem can be used for swapping
73or can contain a filesystem that is mounted in the name space.  If you
74want to use swap backing store for your device instead of a file, you
75can leave regular_file out and specify the size of the block device
76with the -S option.
77.Pp
78Options indicate an action to be performed:
79.Bl -tag -width indent
80.It Fl a
81Read a command file and performs the
82specified actions for each device/file pair.
83.It Fl c
84Configure the device.
85If successful, references to
86.Ar special_file
87will access the contents of
88.Ar regular_file .
89.It Fl d
90Disable (if possible) the specified feature.
91.It Fl e
92Configure the device and enables any
93.Ar feature
94that was specified.
95If no feature was specified,
96.Fl e
97is the same as
98.Fl c .
99.It Fl f Ar config_file
100Use
101.Ar config_file
102as an alternate config file.
103.It Fl g
104Fiddle global options.
105.It Fl r Ar flag
106Reset
107.Ar flag .
108The list of allowed flags and their meanings are:
109.Bl -tag -width "follow"
110.It Ar labels
111use disk/slice labels.
112.It Ar reserve
113Pre-reserve the blocks underlying the file or swap backing store.  Currently only
114works for swap backing store.  This option also disables on-the-fly freeing of
115the underlying backing store (for example, when you remove a large file).
116Use this option if you wish to avoid long-term fragmentation of the backing
117store.  Also note that when this option is used, the initial contents of the
118backing store may contain garbage rather than zeros.  It may even be possible to
119recover the prior contents of a swap-backed VN across a reboot if the VN device
120is configured before any swap is allocated by the system.
121.It Ar follow
122debug flow in the
123.Xr vn 4
124driver.
125.It Ar debug
126debug data in the
127.Xr vn 4
128driver.
129.It Ar io
130debug I/O in the
131.Xr vn 4
132driver.
133.It Ar all
134turn on all flags.
135.It Ar none
136turn off all flags.
137.El
138.It Fl s Ar flag
139Set
140.Ar flag .
141The list of allowed flags and their meanings are the same as for the
142.Fl r
143option.
144.It Fl S Xo
145.Sm off
146.Ar value
147.Es \&{ \&}
148.En Cm k , m , g , t
149.Sm on
150.Xc
151If no regular file is specified, VN will use swap for backing store.
152This option specifies the size of the device.  For example, '23m' for
15323 megabytes.  The VN device will round the size up to a machine page boundary.
154Filesystems up to 7.9 terabytes are supported.  When specified along with
155a regular file, this option overrides the regular file's size insofar as
156VN is concerned.
157.It Fl T
158When a regular file is specified, VN will ftruncate() the file to 0 first.
159Normally you should also specify the -S option to set the size of the file.
160This option also creates the file if it did not previously exist.
161This option is only meaningful if the -S option has been specified.
162.It Fl Z
163When a regular file is specified, VN will zero the contents of the file to
164ensure that all blocks have been allocated by the filesystem.  This option is
165only meaningful if the -S option has been specified.
166.It Fl u
167Disable and ``unconfigure'' the device.
168.It Fl v
169Print messages to stdout describing actions taken.
170.El
171.Pp
172If no action option is given,
173.Fl c
174is assumed.
175.Pp
176The
177.Ar feature
178argument specifies a feature that can be enabled via the
179.Fl e
180option:
181.Bl -tag -width indent
182.It Dv swap
183Swapping is enabled on the special file.
184See
185.Xr swapon 2 .
186.It Dv mountro Ns = Ns Pa mount_point
187The special file is mounted read-only on
188.Ar mount_point .
189See
190.Xr mount 2 .
191.It Dv mountrw Ns = Ns Pa mount_point
192The special file is mounted read-write on
193.Ar mount_point .
194See
195.Xr mount 2 .
196.It Dv mount Ns = Ns Pa mount_point
197Same as ``mountrw=''.
198.El
199.Pp
200A configuration file contains one line per device/file pair in the form:
201.Bd -literal
202	special_file	regular_file	[ feature ]
203.Ed
204.Pp
205where fields are separated by white space.
206The previously described action options serve to configure, enable,
207disable or unconfigure all devices in the configuration file.
208.Sh FILES
209.Bl -tag -width /etc/vntab -compact
210.It Pa /etc/vntab
211default configuration file for
212.Fl a
213option
214.El
215.Sh EXAMPLES
216.Dl vnconfig vn0 /tmp/diskimage
217.Pp
218Configures the vnode disk
219.Pa vn0 .
220.Pp
221.Dl vnconfig -e vn0 /var/swapfile swap
222.Pp
223Configures
224.Pa vn0
225and enables swapping on it.
226.Pp
227.Dl vnconfig -c -v /dev/vn0 cdimage.iso
228.Dl mount -t cd9660 -o ro /dev/vn0 /mnt
229.Pp
230Mount an ISO9660 CD image file.
231.Pp
232.Dl umount /mnt
233.Dl vnconfig -u vn0
234.Pp
235Unmount the CD image file.
236.Pp
237.Dl vnconfig -d vn0 myfilesystem mount=/mnt
238.Pp
239Unmounts (disables)
240.Pa vn0 .
241.Pp
242.Dl vnconfig -ae
243.Pp
244Configures and enables all devices specified in
245.Pa /etc/vntab .
246.Pp
247.Dl vnconfig -s labels -c vn0 somebackingfile
248.Dl disklabel -r -w vn0s0 auto
249.Dl disklabel -e vn0s0
250.Pp
251Is an example of how to configure a file-backed VN disk with a disk label
252and to initialize and then edit the label.  Once you create the label, you
253can partition your VN disk and, for example, create a filesystem on one of
254the partitions.  If you are using a file as backing store, it may be possible
255to recover your VN disk after a crash by vnconfig'ing the same file again
256and using the VN configuration already stored in the file rather than
257relabeling and recreating the filesystem.  It is even possible to fsck the
258VN partitions that previously contained filesystems.
259.Pp
260.Dl vnconfig -e -s labels,reserve -S 400m vn1
261.Dl disklabel -r -w vn1s0 auto
262.Dl newfs /dev/vn1s0
263.Dl mount /dev/vn1s0 /usr/obj
264.Pp
265Is an example of a swap-backed VN disk configuration.  This example assumes
266that you have at least 400 megabytes of swap free (and hopefully much more).
267The swap space is pre-reserved in order to maintain maximum performance.
268We then label the disk, newfs it, and mount it as /usr/obj.  Swap-backed VN
269devices are recoverable after a crash if you (A) use the reserve flag, and if
270(B) the same swap is reserved as was the last time, meaning that such
271vnconfig's would have to be run in your rc.local.  In general, though, you
272only use swap-backed VN devices to hold information you don't mind losing
273on every reboot.
274.Sh SEE ALSO
275.Xr mount 2 ,
276.Xr swapon 2 ,
277.Xr unmount 2 ,
278.Xr vn 4
279