1.\" $NetBSD: vnconfig.8,v 1.42 2016/04/10 09:49:14 wiz Exp $ 2.\" 3.\" Copyright (c) 1997 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Jason R. Thorpe. 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.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28.\" POSSIBILITY OF SUCH DAMAGE. 29.\" 30.\" Copyright (c) 1993 University of Utah. 31.\" Copyright (c) 1980, 1989, 1991, 1993 32.\" The Regents of the University of California. All rights reserved. 33.\" 34.\" This code is derived from software contributed to Berkeley by 35.\" the Systems Programming Group of the University of Utah Computer 36.\" Science Department. 37.\" 38.\" Redistribution and use in source and binary forms, with or without 39.\" modification, are permitted provided that the following conditions 40.\" are met: 41.\" 1. Redistributions of source code must retain the above copyright 42.\" notice, this list of conditions and the following disclaimer. 43.\" 2. Redistributions in binary form must reproduce the above copyright 44.\" notice, this list of conditions and the following disclaimer in the 45.\" documentation and/or other materials provided with the distribution. 46.\" 3. Neither the name of the University nor the names of its contributors 47.\" may be used to endorse or promote products derived from this software 48.\" without specific prior written permission. 49.\" 50.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 51.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 52.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 53.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 54.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 55.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 56.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 57.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 58.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 59.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 60.\" SUCH DAMAGE. 61.\" 62.\" @(#)vnconfig.8 8.1 (Berkeley) 6/5/93 63.\" 64.Dd November 6, 2015 65.Dt VNDCONFIG 8 66.Os 67.Sh NAME 68.Nm vndconfig 69.Nd configure vnode disks 70.Sh SYNOPSIS 71.Nm 72.\" Fcf:lm:rt:uvz 73.Op Fl crvz 74.Op Fl f Ar disktab 75.Op Fl t Ar typename 76.Ar vnode_disk 77.Ar regular_file 78.Op Ar geomspec 79.Nm 80.Fl u 81.Op Fl Fv 82.Ar vnode_disk 83.Nm 84.Fl l 85.Op Fl m Ar min 86.Op Ar vnode_disk ... 87.Sh DESCRIPTION 88The 89.Nm 90command configures vnode pseudo disk devices. 91It will associate the vnode disk 92.Ar vnode_disk 93with the regular file 94.Ar regular_file 95allowing the latter to be accessed as though it were a disk. 96Hence a regular file within the filesystem can be used for swapping 97or can contain a filesystem that is mounted in the name space. 98The 99.Ar vnode_disk 100is a special file of raw partition or name of vnode disk like 101.Pa vnd0 . 102.Pp 103Options indicate an action to be performed: 104.Bl -tag -width indent 105.It Fl c 106Configures the device. 107If successful, references to 108.Ar vnode_disk 109will access the contents of 110.Ar regular_file . 111.Pp 112If 113.Ar geomspec 114is specified, the vnode device will emulate the specified disk geometry. 115The format of the 116.Ar geomspec 117argument is: 118.Bd -ragged -offset indent 119.Sm off 120.Xo Ar secsize Li / Ar nsectors Li / 121.Ar ntracks Li / Ar ncylinders Xc 122.Sm on 123.Ed 124.Pp 125If geometry is not specified, the kernel will choose a default based on 1MB 126cylinders. 127.Ar secsize 128is the number of bytes per sector. 129It must be a power of two, and at least 512. 130.Ar nsectors 131is the number of sectors per track. 132.Ar ntracks 133is the number of tracks per cylinder. 134.Ar ncylinders 135is the number of cylinders in the device. 136.It Fl F 137Force unconfiguration if the device is in use. 138Does not imply 139.Fl u . 140.It Fl f Ar disktab 141Specifies that the 142.Fl t 143option should look up in 144.Ar disktab 145instead of in 146.Pa /etc/disktab . 147.It Fl l 148List the vnd devices and indicate which ones are in use. 149If one or more specific 150.Ar vnode_disks 151are given, then only those will be described. 152.It Fl m Ar min 153Together with 154.Fl l 155and if no specific devices are given, 156causes at least 157.Ar min 158devices to be listed. 159The default for 160.Ar min 161is 4, 162but all vnd devices up to (and sometimes just beyond) 163the highest numbered vnd device configured since 164the system last booted will be listed. 165If 166.Ar min 167is set to 0, 168then only vnd devices currently in use will be shown. 169.It Fl r 170Configure the device as read-only. 171.It Fl t Ar typename 172If configuring the device, look up 173.Ar typename 174in 175.Pa /etc/disktab 176and use the geometry specified in the entry. 177This option and the 178.Ar geomspec 179argument are mutually exclusive. 180.It Fl u 181Unconfigures the device. 182.It Fl v 183Print messages to stdout describing actions taken. 184.It Fl z 185Assume that 186.Ar regular_file 187is a compressed disk image in cloop2 format, and configure it 188read-only. 189See the 190.Xr vndcompress 1 191manpage on how to create such an image. 192.El 193.Pp 194If no action option 195.Op Fl clu 196is given, 197.Fl c 198is assumed. 199.Sh FILES 200.Bl -tag -width /etc/disktab -compact 201.It Pa /dev/rvnd?? 202.It Pa /dev/vnd?? 203.It Pa /etc/disktab 204.El 205.Sh EXIT STATUS 206.Nm 207will exit with status 0 if the operation requested 208completed successfully, 209or 1 otherwise. 210Unsuccessful completion can be caused by unknown or 211incorrectly used options; 212attempting to configure a vnd that is already configured; 213or unconfigure one that is not, or without 214.Fl F , 215one which is still in use; 216or if devices are specified that do not exist or are not 217.Xr vnd 4 218devices, giving an improper geometry, etc. 219.Sh EXAMPLES 220.Dl vndconfig vnd0 /tmp/diskimage 221or 222.Dl vndconfig /dev/rvnd0c /tmp/diskimage 223.Pp 224Configures the vnode disk 225.Pa vnd0 . 226Please note that use of the second form of the command is discouraged because 227it requires knowledge of the raw partition which varies between architectures. 228For the first form, be aware that there must not be a file 229.Ar vnd0 230in the current directory, or it will be assumed to be the vnd device to 231be configured (which will usually fail.) 232.Pp 233.Dl vndconfig vnd0 /tmp/floppy.img 512/18/2/80 234.Pp 235Configures the vnode disk 236.Pa vnd0 237emulating the geometry of 512 bytes per sector, 18 sectors per track, 2382 tracks per cylinder, and 80 cylinders total. 239.Pp 240.Dl vndconfig -t floppy vnd0 /tmp/floppy.img 241.Pp 242Configures the vnode disk 243.Pa vnd0 244using the geometry specified in the 245.Pa floppy 246entry in 247.Pa /etc/disktab . 248.Pp 249.Dl vndconfig -u vnd0 250.Pp 251Unconfigures the 252.Pa vnd0 253device. 254.Pp 255To obtain status on all vnd devices listed in 256.Pa /dev 257(assuming a system where the 258.Sq d 259partition is the whole device 260.Pq Dv RAW_PART ) , 261use: 262.Pp 263.Dl vndconfig -l /dev/vnd*d 264.Pp 265Using 266.Dl vndconfig -m0 -l /dev/vnd*d 267will omit those devices that are not in use, whereas 268.Dl vnconfig -l 269will list all devices known to the kernel (at least 4 270without 271.Fl m ) 272regardless of what might appear in 273.Pa /dev 274(or elsewhere.) 275.Sh SEE ALSO 276.Xr vndcompress 1 , 277.Xr opendisk 3 , 278.Xr vnd 4 , 279.Xr mount 8 , 280.Xr swapctl 8 , 281.Xr umount 8 282.Sh HISTORY 283The 284.Nm vnconfig 285command appeared in 286.Nx 1.0 . 287It was renamed to 288.Nm 289in 290.Nx 7.0 291for consistency with other similar commands. 292(The original name was also retained as an alternative 293for backwards compatibility.) 294