VNCONFIG(8)

NAME
vnconfig - configure and enable vnode disks

SYNOPSIS
vnconfig [-cdeguvTZ] [-s options] [-r options] [-S value] special_file [regular_file] [feature]
vnconfig -a [-cdeguv] [-s options] [-r options] [-f config_file]
vnconfig -l [special_file ...]

DESCRIPTION
The vnconfig command configures, enables and lists vnode pseudo disk devices. The first form of the command will associate the special file special_file with the regular file 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. If you want to use swap backing store for your device instead of a file, you can leave regular_file out and specify the size of the block device with the -S option.

Options indicate an action to be performed:

-a  Read a command file and performs the specified actions for each device/file pair.

-c  Configure the device. If successful, references to special_file will access the contents of regular_file.

    A vn device is autocloned if special_file is given as vn, the name of the resulting device is printed on stdout.

-d  Disable (if possible) the specified feature.

-e  Configure the device and enables any feature that was specified. If no feature was specified, -e is the same as -c.

-f config_file
    Specify configuration file. Default is /etc/vntab.

-g  Fiddle global options.

-l special_file ...
    List the vn devices and indicate which ones are in use. If a special_file list is given, only those devices will be described.

-r options
    Reset options, which is a comma separated string of options. The list of allowed options and their meanings are:

    reserve
        Pre-reserve the blocks underlying the file or swap backing store. Currently only works for swap backing store. This option also disables on-the-fly freeing of the underlying backing store (for example, when you remove a large file). Use this option if you wish to avoid long-term fragmentation of the backing store. Also note that when this option is used, the initial contents of the backing store may contain garbage rather than zeros. It may even be possible to recover the prior contents of a swap-backed vn across a reboot if the vn device is configured before any swap is allocated by the system.

    follow
        Debug flow in the vn(4) driver.

    debug
        Debug data in the vn(4) driver.

    io  Debug I/O in the vn(4) driver.

    all Turn on all options.

    none
        Turn off all options.

-s options
    Set options, which is a comma separated string of options. The list of allowed options and their meanings are the same as for the -r option.

-S  value {k,m,g,t} If no regular file is specified, vn will use swap for backing store. This option specifies the size of the device. For example, ‘23m’ for 23 megabytes. In the absence of a size modifier, m is implied. The vn device will round the size up to a machine page boundary. Filesystems up to 7.9 terabytes are supported. When specified along with a regular file, this option overrides the regular file's size insofar as vn is concerned.

-T  When a regular file is specified, vnconfig will ftruncate() the file to length 0 first. Normally you should also specify the -S option to set the size of the file. This option also creates the file if it did not previously exist. This option is only meaningful if the -S option has been specified.

-Z  When a regular file is specified, vnconfig will zero the contents of the file to ensure that all blocks have been allocated by the filesystem. This option is only meaningful if the -S option has been specified.

-u  Disable and ``unconfigure'' the device.

-v  Print messages to stdout describing actions taken.

If no action option is given, -c is assumed.

The feature argument specifies a feature that can be enabled via the -e option:

swap
    Swapping is enabled on the special file. See swapon(2).

mountro=mount_point
    The special file is mounted read-only on mount_point. See mount(2).

mountrw=mount_point
    The special file is mounted read-write on mount_point. See mount(2).

mount=mount_point
    Same as mountrw=mount_point.

A configuration file contains one line per device/file pair in the form:

    	special_file	regular_file	[feature]

where fields are separated by white space. Lines starting with ‘#’ are ignored. The previously described action options serve to configure, enable, disable or unconfigure all devices in the configuration file.

FILES
/etc/vntab
    default configuration file for -a option

EXAMPLES
    vnconfig vn /tmp/diskimage

Configures an autocloned vnode disk, the name of the resulting device is printed, e.g. vn4.

    vnconfig vn0 /tmp/diskimage

Configures the vnode disk vn0.

    vnconfig -e vn0 /var/swapfile swap

Configures vn0 and enables swapping on it.

    vnconfig -c -v /dev/vn0 cdimage.iso
    mount -t cd9660 -o ro /dev/vn0 /mnt

Mount an ISO9660 CD image file.

    umount /mnt
    vnconfig -u vn0

Unmount the CD image file.

    vnconfig -d vn0 myfilesystem mount=/mnt

Unmounts (disables) vn0.

    vnconfig -ae

Configures and enables all devices specified in /etc/vntab.

    vnconfig -c vn0 somebackingfile
    disklabel -r -w vn0s0 auto
    disklabel -e vn0s0

Is an example of how to configure a file-backed vn disk with a disk label and to initialize and then edit the label. Once you create the label, you can partition your vn disk and, for example, create a filesystem on one of the partitions. If you are using a file as backing store, it may be possible to recover your vn disk after a crash by vnconfig'ing the same file again and using the vn configuration already stored in the file rather than relabeling and recreating the filesystem. It is even possible to fsck(8) the vn partitions that previously contained filesystems.

    vnconfig -e -s reserve -S 400m vn1
    disklabel -r -w vn1s0 auto
    newfs /dev/vn1s0
    mount /dev/vn1s0 /usr/obj

Is an example of a swap-backed vn disk configuration. This example assumes that you have at least 400 megabytes of swap free (and hopefully much more). The swap space is pre-reserved in order to maintain maximum performance. We then label the disk, newfs it, and mount it as /usr/obj. Swap-backed vn devices are recoverable after a crash if you (A) use the reserve option, and if (B) the same swap is reserved as was the last time, meaning that such vnconfig's would have to be run in your rc.local(8). In general, though, you only use swap-backed vn devices to hold information you don't mind losing on every reboot.

SEE ALSO
mount(2), swapon(2), unmount(2), vn(4)