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