1.\" $NetBSD: vnconfig.8,v 1.46 2021/01/09 23:54:26 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 January 10, 2021 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 cirvz 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 i 148Configure the device to use regular file I/O even when direct I/O using 149bmap/strategy would be possible. 150.It Fl l 151List the vnd devices and indicate which ones are in use. 152If one or more specific 153.Ar vnode_disks 154are given, then only those will be described. 155.It Fl m Ar min 156Together with 157.Fl l 158and if no specific devices are given, 159causes at least 160.Ar min 161devices to be listed. 162The default for 163.Ar min 164is 4, 165but all vnd devices up to (and sometimes just beyond) 166the highest numbered vnd device configured since 167the system last booted will be listed. 168If 169.Ar min 170is set to 0, 171then only vnd devices currently in use will be shown. 172.It Fl r 173Configure the device as read-only. 174.It Fl t Ar typename 175If configuring the device, look up 176.Ar typename 177in 178.Pa /etc/disktab 179and use the geometry specified in the entry. 180This option and the 181.Ar geomspec 182argument are mutually exclusive. 183.It Fl u 184Unconfigures the device. 185.It Fl v 186Print messages to stdout describing actions taken. 187.It Fl z 188Assume that 189.Ar regular_file 190is a compressed disk image in cloop2 format, and configure it 191read-only. 192See the 193.Xr vndcompress 1 194manpage on how to create such an image. 195.El 196.Pp 197If no action option 198.Op Fl clu 199is given, 200.Fl c 201is assumed. 202.Sh FILES 203.Bl -tag -width /etc/disktab -compact 204.It Pa /dev/rvnd?? 205.It Pa /dev/vnd?? 206.It Pa /etc/disktab 207.El 208.Sh EXIT STATUS 209.Nm 210will exit with status 0 if the operation requested 211completed successfully, 212or 1 otherwise. 213Unsuccessful completion can be caused by unknown or 214incorrectly used options; 215attempting to configure a vnd that is already configured; 216or unconfigure one that is not, or without 217.Fl F , 218one which is still in use; 219or if devices are specified that do not exist or are not 220.Xr vnd 4 221devices, giving an improper geometry, etc. 222.Sh EXAMPLES 223.Dl vndconfig vnd0 /tmp/diskimage 224or 225.Dl vndconfig /dev/rvnd0c /tmp/diskimage 226.Pp 227Configures the vnode disk 228.Pa vnd0 . 229Please note that use of the second form of the command is discouraged because 230it requires knowledge of the raw partition which varies between architectures. 231For the first form, be aware that there must not be a file 232.Ar vnd0 233in the current directory, or it will be assumed to be the vnd device to 234be configured (which will usually fail.) 235.Pp 236.Dl vndconfig vnd0 /tmp/floppy.img 512/18/2/80 237.Pp 238Configures the vnode disk 239.Pa vnd0 240emulating the geometry of 512 bytes per sector, 18 sectors per track, 2412 tracks per cylinder, and 80 cylinders total. 242.Pp 243.Dl vndconfig vnd0 /tmp/image.udf 2048/1/1/0 244.Pp 245Configures the vnode disk 246.Pa vnd0 247for an UDF image to be used with 248.Xr mount_udf 8 . 249.Pp 250.Dl vndconfig -t floppy vnd0 /tmp/floppy.img 251.Pp 252Configures the vnode disk 253.Pa vnd0 254using the geometry specified in the 255.Pa floppy 256entry in 257.Pa /etc/disktab . 258.Pp 259.Dl vndconfig -u vnd0 260.Pp 261Unconfigures the 262.Pa vnd0 263device. 264.Pp 265To obtain status on all vnd devices listed in 266.Pa /dev 267(assuming a system where the 268.Sq d 269partition is the whole device 270.Pq Dv RAW_PART ) , 271use: 272.Pp 273.Dl vndconfig -l /dev/vnd*d 274.Pp 275Using 276.Dl vndconfig -m0 -l /dev/vnd*d 277will omit those devices that are not in use, whereas 278.Dl vndconfig -l 279will list all devices known to the kernel (at least 4 280without 281.Fl m ) 282regardless of what might appear in 283.Pa /dev 284(or elsewhere.) 285.Sh SEE ALSO 286.Xr vndcompress 1 , 287.Xr opendisk 3 , 288.Xr vnd 4 , 289.Xr mount 8 , 290.Xr swapctl 8 , 291.Xr umount 8 292.Sh HISTORY 293The 294.Nm vnconfig 295command appeared in 296.Nx 1.0 . 297It was renamed to 298.Nm 299in 300.Nx 7.0 301for consistency with other similar commands. 302(The original name was also retained as an alternative 303for backwards compatibility.) 304