2023-10-22 02:42:03 +03:00
|
|
|
.\" $NetBSD: vnconfig.8,v 1.50 2023/10/21 23:42:03 gdt Exp $
|
1997-06-24 01:11:06 +04:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
.\" by Jason R. Thorpe.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
1997-07-31 02:53:50 +04:00
|
|
|
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
1997-06-24 01:11:06 +04:00
|
|
|
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
1995-12-30 21:14:01 +03:00
|
|
|
.\"
|
2011-02-08 23:20:06 +03:00
|
|
|
.\" Copyright (c) 1993 University of Utah.
|
1993-12-21 07:13:39 +03:00
|
|
|
.\" Copyright (c) 1980, 1989, 1991, 1993
|
|
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" This code is derived from software contributed to Berkeley by
|
|
|
|
.\" the Systems Programming Group of the University of Utah Computer
|
2003-08-07 15:25:11 +04:00
|
|
|
.\" Science Department.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. Neither the name of the University nor the names of its contributors
|
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
2011-02-09 13:25:40 +03:00
|
|
|
.\" @(#)vnconfig.8 8.1 (Berkeley) 6/5/93
|
|
|
|
.\"
|
2023-10-20 16:04:21 +03:00
|
|
|
.Dd October 20, 2023
|
2013-06-09 22:39:05 +04:00
|
|
|
.Dt VNDCONFIG 8
|
1999-03-22 21:43:46 +03:00
|
|
|
.Os
|
1993-12-21 07:13:39 +03:00
|
|
|
.Sh NAME
|
2013-06-09 22:39:05 +04:00
|
|
|
.Nm vndconfig
|
1995-01-22 09:18:12 +03:00
|
|
|
.Nd configure vnode disks
|
1993-12-21 07:13:39 +03:00
|
|
|
.Sh SYNOPSIS
|
2003-02-25 13:34:36 +03:00
|
|
|
.Nm
|
2016-04-10 12:04:09 +03:00
|
|
|
.\" Fcf:lm:rt:uvz
|
2018-10-07 23:30:50 +03:00
|
|
|
.Op Fl cirvz
|
2001-12-12 19:55:10 +03:00
|
|
|
.Op Fl f Ar disktab
|
1997-06-24 01:11:06 +04:00
|
|
|
.Op Fl t Ar typename
|
1997-10-01 05:32:59 +04:00
|
|
|
.Ar vnode_disk
|
1995-01-22 10:06:44 +03:00
|
|
|
.Ar regular_file
|
1997-06-24 01:11:06 +04:00
|
|
|
.Op Ar geomspec
|
2003-02-25 13:34:36 +03:00
|
|
|
.Nm
|
1997-10-18 07:54:00 +04:00
|
|
|
.Fl u
|
2003-04-16 14:28:55 +04:00
|
|
|
.Op Fl Fv
|
1997-10-01 05:32:59 +04:00
|
|
|
.Ar vnode_disk
|
2003-02-25 13:34:36 +03:00
|
|
|
.Nm
|
2002-06-21 23:09:29 +04:00
|
|
|
.Fl l
|
2016-04-10 12:04:09 +03:00
|
|
|
.Op Fl m Ar min
|
|
|
|
.Op Ar vnode_disk ...
|
1993-12-21 07:13:39 +03:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
1997-10-18 07:54:00 +04:00
|
|
|
.Nm
|
1995-01-22 09:18:12 +03:00
|
|
|
command configures vnode pseudo disk devices.
|
1997-10-01 05:32:59 +04:00
|
|
|
It will associate the vnode disk
|
|
|
|
.Ar vnode_disk
|
1993-12-21 07:13:39 +03:00
|
|
|
with the regular file
|
|
|
|
.Ar regular_file
|
|
|
|
allowing the latter to be accessed as though it were a disk.
|
|
|
|
Hence a regular file within the filesystem can be used for swapping
|
|
|
|
or can contain a filesystem that is mounted in the name space.
|
1997-10-01 05:32:59 +04:00
|
|
|
The
|
|
|
|
.Ar vnode_disk
|
|
|
|
is a special file of raw partition or name of vnode disk like
|
|
|
|
.Pa vnd0 .
|
1993-12-21 07:13:39 +03:00
|
|
|
.Pp
|
2023-10-22 02:38:26 +03:00
|
|
|
By default, accesses to the file bypass normal mechanisms and thus
|
|
|
|
do not read from or fill the filesystem cache.
|
|
|
|
Because the typical approach is to access the file only via
|
|
|
|
.Xr vnd 4 ,
|
|
|
|
or at least to have regular accesses and
|
|
|
|
.Xr vnd 4
|
|
|
|
accesses separated in time, this is generally not problematic.
|
|
|
|
This bypassing behavior results in not updating the modification
|
|
|
|
timestamp of the file.
|
|
|
|
Also, file contents read through the filesystem (and thus the
|
2023-10-22 02:42:03 +03:00
|
|
|
filesystem's caching layer) may not be the contents written via this
|
|
|
|
interface, so caution is in order for backups.
|
2023-10-22 02:38:26 +03:00
|
|
|
The
|
|
|
|
.Fl i
|
|
|
|
option may be useful if it is necessary to avoid inconsistent caching.
|
2023-10-20 15:45:17 +03:00
|
|
|
.Pp
|
1993-12-21 07:13:39 +03:00
|
|
|
Options indicate an action to be performed:
|
|
|
|
.Bl -tag -width indent
|
|
|
|
.It Fl c
|
|
|
|
Configures the device.
|
|
|
|
If successful, references to
|
1997-10-01 05:32:59 +04:00
|
|
|
.Ar vnode_disk
|
1993-12-21 07:13:39 +03:00
|
|
|
will access the contents of
|
|
|
|
.Ar regular_file .
|
2000-09-30 21:58:19 +04:00
|
|
|
.Pp
|
1997-06-24 01:11:06 +04:00
|
|
|
If
|
2000-09-30 21:58:19 +04:00
|
|
|
.Ar geomspec
|
1997-06-24 01:11:06 +04:00
|
|
|
is specified, the vnode device will emulate the specified disk geometry.
|
|
|
|
The format of the
|
2000-09-30 21:58:19 +04:00
|
|
|
.Ar geomspec
|
|
|
|
argument is:
|
|
|
|
.Bd -ragged -offset indent
|
|
|
|
.Sm off
|
|
|
|
.Xo Ar secsize Li / Ar nsectors Li /
|
|
|
|
.Ar ntracks Li / Ar ncylinders Xc
|
|
|
|
.Sm on
|
|
|
|
.Ed
|
|
|
|
.Pp
|
1997-06-24 01:11:06 +04:00
|
|
|
If geometry is not specified, the kernel will choose a default based on 1MB
|
|
|
|
cylinders.
|
2000-09-30 21:58:19 +04:00
|
|
|
.Ar secsize
|
2012-07-09 02:49:55 +04:00
|
|
|
is the number of bytes per sector.
|
2016-04-10 12:04:09 +03:00
|
|
|
It must be a power of two, and at least 512.
|
2000-09-30 21:58:19 +04:00
|
|
|
.Ar nsectors
|
1997-06-24 01:11:06 +04:00
|
|
|
is the number of sectors per track.
|
2000-09-30 21:58:19 +04:00
|
|
|
.Ar ntracks
|
1997-06-24 01:11:06 +04:00
|
|
|
is the number of tracks per cylinder.
|
2000-09-30 21:58:19 +04:00
|
|
|
.Ar ncylinders
|
1997-06-24 01:11:06 +04:00
|
|
|
is the number of cylinders in the device.
|
2003-04-16 14:28:55 +04:00
|
|
|
.It Fl F
|
|
|
|
Force unconfiguration if the device is in use.
|
|
|
|
Does not imply
|
|
|
|
.Fl u .
|
2001-12-12 19:55:10 +03:00
|
|
|
.It Fl f Ar disktab
|
|
|
|
Specifies that the
|
|
|
|
.Fl t
|
|
|
|
option should look up in
|
|
|
|
.Ar disktab
|
|
|
|
instead of in
|
|
|
|
.Pa /etc/disktab .
|
2018-10-07 23:30:50 +03:00
|
|
|
.It Fl i
|
|
|
|
Configure the device to use regular file I/O even when direct I/O using
|
|
|
|
bmap/strategy would be possible.
|
2002-06-21 23:09:29 +04:00
|
|
|
.It Fl l
|
2012-07-09 02:49:55 +04:00
|
|
|
List the vnd devices and indicate which ones are in use.
|
2016-04-10 12:04:09 +03:00
|
|
|
If one or more specific
|
|
|
|
.Ar vnode_disks
|
|
|
|
are given, then only those will be described.
|
|
|
|
.It Fl m Ar min
|
|
|
|
Together with
|
|
|
|
.Fl l
|
|
|
|
and if no specific devices are given,
|
|
|
|
causes at least
|
|
|
|
.Ar min
|
|
|
|
devices to be listed.
|
|
|
|
The default for
|
|
|
|
.Ar min
|
|
|
|
is 4,
|
|
|
|
but all vnd devices up to (and sometimes just beyond)
|
|
|
|
the highest numbered vnd device configured since
|
|
|
|
the system last booted will be listed.
|
|
|
|
If
|
|
|
|
.Ar min
|
|
|
|
is set to 0,
|
|
|
|
then only vnd devices currently in use will be shown.
|
|
|
|
.It Fl r
|
|
|
|
Configure the device as read-only.
|
1997-06-24 01:11:06 +04:00
|
|
|
.It Fl t Ar typename
|
|
|
|
If configuring the device, look up
|
|
|
|
.Ar typename
|
|
|
|
in
|
|
|
|
.Pa /etc/disktab
|
2012-07-09 02:49:55 +04:00
|
|
|
and use the geometry specified in the entry.
|
|
|
|
This option and the
|
1997-06-24 01:11:06 +04:00
|
|
|
.Ar geomspec
|
2000-10-02 19:11:43 +04:00
|
|
|
argument are mutually exclusive.
|
2003-04-16 14:28:55 +04:00
|
|
|
.It Fl u
|
|
|
|
Unconfigures the device.
|
1993-12-21 07:13:39 +03:00
|
|
|
.It Fl v
|
|
|
|
Print messages to stdout describing actions taken.
|
2005-07-17 04:08:27 +04:00
|
|
|
.It Fl z
|
|
|
|
Assume that
|
2005-09-12 03:49:58 +04:00
|
|
|
.Ar regular_file
|
2005-07-18 18:07:18 +04:00
|
|
|
is a compressed disk image in cloop2 format, and configure it
|
2005-07-17 04:08:27 +04:00
|
|
|
read-only.
|
|
|
|
See the
|
|
|
|
.Xr vndcompress 1
|
2005-07-18 18:06:05 +04:00
|
|
|
manpage on how to create such an image.
|
1993-12-21 07:13:39 +03:00
|
|
|
.El
|
|
|
|
.Pp
|
2016-04-10 12:04:09 +03:00
|
|
|
If no action option
|
|
|
|
.Op Fl clu
|
|
|
|
is given,
|
1993-12-21 07:13:39 +03:00
|
|
|
.Fl c
|
|
|
|
is assumed.
|
2016-04-10 12:49:14 +03:00
|
|
|
.Sh FILES
|
|
|
|
.Bl -tag -width /etc/disktab -compact
|
|
|
|
.It Pa /dev/rvnd??
|
|
|
|
.It Pa /dev/vnd??
|
|
|
|
.It Pa /etc/disktab
|
|
|
|
.El
|
2016-04-10 12:04:09 +03:00
|
|
|
.Sh EXIT STATUS
|
|
|
|
.Nm
|
|
|
|
will exit with status 0 if the operation requested
|
|
|
|
completed successfully,
|
|
|
|
or 1 otherwise.
|
|
|
|
Unsuccessful completion can be caused by unknown or
|
|
|
|
incorrectly used options;
|
|
|
|
attempting to configure a vnd that is already configured;
|
|
|
|
or unconfigure one that is not, or without
|
|
|
|
.Fl F ,
|
|
|
|
one which is still in use;
|
|
|
|
or if devices are specified that do not exist or are not
|
|
|
|
.Xr vnd 4
|
|
|
|
devices, giving an improper geometry, etc.
|
1993-12-21 07:13:39 +03:00
|
|
|
.Sh EXAMPLES
|
2013-06-09 22:39:05 +04:00
|
|
|
.Dl vndconfig vnd0 /tmp/diskimage
|
2001-11-08 18:41:55 +03:00
|
|
|
or
|
2013-06-09 22:39:05 +04:00
|
|
|
.Dl vndconfig /dev/rvnd0c /tmp/diskimage
|
1993-12-21 07:13:39 +03:00
|
|
|
.Pp
|
|
|
|
Configures the vnode disk
|
1997-10-01 05:32:59 +04:00
|
|
|
.Pa vnd0 .
|
2001-11-08 18:41:55 +03:00
|
|
|
Please note that use of the second form of the command is discouraged because
|
|
|
|
it requires knowledge of the raw partition which varies between architectures.
|
2016-04-10 12:04:09 +03:00
|
|
|
For the first form, be aware that there must not be a file
|
|
|
|
.Ar vnd0
|
|
|
|
in the current directory, or it will be assumed to be the vnd device to
|
|
|
|
be configured (which will usually fail.)
|
1993-12-21 07:13:39 +03:00
|
|
|
.Pp
|
2013-06-09 22:39:05 +04:00
|
|
|
.Dl vndconfig vnd0 /tmp/floppy.img 512/18/2/80
|
1997-06-24 01:11:06 +04:00
|
|
|
.Pp
|
|
|
|
Configures the vnode disk
|
1997-10-01 05:32:59 +04:00
|
|
|
.Pa vnd0
|
1997-06-24 01:11:06 +04:00
|
|
|
emulating the geometry of 512 bytes per sector, 18 sectors per track,
|
|
|
|
2 tracks per cylinder, and 80 cylinders total.
|
|
|
|
.Pp
|
2021-01-10 02:54:26 +03:00
|
|
|
.Dl vndconfig vnd0 /tmp/image.udf 2048/1/1/0
|
|
|
|
.Pp
|
|
|
|
Configures the vnode disk
|
|
|
|
.Pa vnd0
|
|
|
|
for an UDF image to be used with
|
|
|
|
.Xr mount_udf 8 .
|
|
|
|
.Pp
|
2013-06-09 22:39:05 +04:00
|
|
|
.Dl vndconfig -t floppy vnd0 /tmp/floppy.img
|
1997-06-24 01:11:06 +04:00
|
|
|
.Pp
|
|
|
|
Configures the vnode disk
|
1997-10-01 05:32:59 +04:00
|
|
|
.Pa vnd0
|
1997-06-24 01:11:06 +04:00
|
|
|
using the geometry specified in the
|
|
|
|
.Pa floppy
|
|
|
|
entry in
|
|
|
|
.Pa /etc/disktab .
|
|
|
|
.Pp
|
2013-06-09 22:39:05 +04:00
|
|
|
.Dl vndconfig -u vnd0
|
1993-12-21 07:13:39 +03:00
|
|
|
.Pp
|
1995-01-22 09:18:12 +03:00
|
|
|
Unconfigures the
|
1997-10-01 05:32:59 +04:00
|
|
|
.Pa vnd0
|
1995-01-22 09:18:12 +03:00
|
|
|
device.
|
2016-04-10 12:04:09 +03:00
|
|
|
.Pp
|
2016-04-10 12:49:14 +03:00
|
|
|
To obtain status on all vnd devices listed in
|
|
|
|
.Pa /dev
|
2016-04-10 12:04:09 +03:00
|
|
|
(assuming a system where the
|
|
|
|
.Sq d
|
2016-04-10 12:49:14 +03:00
|
|
|
partition is the whole device
|
|
|
|
.Pq Dv RAW_PART ) ,
|
|
|
|
use:
|
2016-04-10 12:04:09 +03:00
|
|
|
.Pp
|
|
|
|
.Dl vndconfig -l /dev/vnd*d
|
|
|
|
.Pp
|
|
|
|
Using
|
|
|
|
.Dl vndconfig -m0 -l /dev/vnd*d
|
|
|
|
will omit those devices that are not in use, whereas
|
2018-05-01 12:03:49 +03:00
|
|
|
.Dl vndconfig -l
|
2016-04-10 12:04:09 +03:00
|
|
|
will list all devices known to the kernel (at least 4
|
|
|
|
without
|
|
|
|
.Fl m )
|
2016-04-10 12:49:14 +03:00
|
|
|
regardless of what might appear in
|
|
|
|
.Pa /dev
|
|
|
|
(or elsewhere.)
|
1993-12-21 07:13:39 +03:00
|
|
|
.Sh SEE ALSO
|
2012-07-09 02:49:55 +04:00
|
|
|
.Xr vndcompress 1 ,
|
1997-10-01 05:32:59 +04:00
|
|
|
.Xr opendisk 3 ,
|
1998-05-22 22:27:50 +04:00
|
|
|
.Xr vnd 4 ,
|
1995-01-22 09:18:12 +03:00
|
|
|
.Xr mount 8 ,
|
2002-02-02 05:08:23 +03:00
|
|
|
.Xr swapctl 8 ,
|
1998-05-22 22:27:50 +04:00
|
|
|
.Xr umount 8
|
2000-10-02 20:21:27 +04:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
2015-11-06 01:35:24 +03:00
|
|
|
.Nm vnconfig
|
2000-10-02 20:21:27 +04:00
|
|
|
command appeared in
|
|
|
|
.Nx 1.0 .
|
2015-11-06 01:35:24 +03:00
|
|
|
It was renamed to
|
|
|
|
.Nm
|
|
|
|
in
|
|
|
|
.Nx 7.0
|
|
|
|
for consistency with other similar commands.
|
2016-04-10 12:04:09 +03:00
|
|
|
(The original name was also retained as an alternative
|
|
|
|
for backwards compatibility.)
|