MOUNT_VND(8)            OpenBSD System Manager's Manual           MOUNT_VND(8)

NAME
     mount_vnd, vnconfig - configure vnode disks

SYNOPSIS
     mount_vnd [-k] [-K rounds] [-o options] [-S saltfile] [-t disktype] image
               vnd_dev
     vnconfig [-ckluv] [-K rounds] [-S saltfile] [-t disktype] vnd_dev image

DESCRIPTION
     The vnconfig command configures vnode pseudo disk devices.  It will asso-
     ciate (or disassociate) the special file vnd_dev with the regular file
     image, allowing the latter to be accessed as though it were a disk.
     Hence a regular file within the file system can be used for swapping or
     can contain a file system that is mounted in the name space.

     Both traditional devices, vnd(4), and the cache-coherent devices, svnd,
     are configured through vnconfig.  svnd should be mounted with the
     mount(8) option ``sync'' if image is being read from, to ensure consis-
     tency in the buffer cache.  For normal operation this is not necessary.

     mount_vnd works similarly to vnconfig, but it provides an interface that
     can be used by the fstab(5) infrastructure, so that an image file can be
     configured to a device node while booting.  mount_vnd defaults to the
     svnd0 device.

     For fstab(5) lines with type ``ffs'', the ``noauto'' option must be set
     to prevent a mount(8) of the FFS partitions before the necessary vnd de-
     vices are configured.  Also, the ``fs_passno'' field has to be set to 0
     to prevent fsck(8) from checking the file system for the same reasons.

     mount_vnd is invoked by mount(8) when using the following syntax:

         mount [options] -t vnd image node

     The options are as follows:

     -c      vnconfig only.  Configures the device.  If successful, references
             to vnd_dev will access the contents of image.  This is the de-
             fault operation.

     -K rounds
             Associate an encryption key with the device.  All data will be
             encrypted using the Blowfish cipher before it is written to the
             disk.  The user is asked for both a passphrase and the name of a
             salt file.  The salt file can also be specified on the command
             line using the -S option.  The passphrase and salt are combined
             according to PKCS #5 PBKDF2 for the specified number of rounds to
             generate the actual key used.  rounds is a number between 1000
             and INT_MAX.  DO NOT LOSE THE SALT FILE.  Encryption only works
             with svnd.

     -k      Associate an encryption key with the device.  All data will be
             encrypted using the Blowfish cipher before it is written to the
             disk.  Encryption only works with svnd.

     -l      vnconfig only.  List the (s)vnd devices and indicate which ones
             are in use.  If a specific vnd_dev is given, then only that one
             will be described.

     -o options
             mount_vnd only.  Options are specified with a -o flag followed by
             a comma separated string of options.  See the mount(8) man page
             for possible options and their meanings.

             At the moment, -o is only here for compatibility reasons, but no
             use is made of supplied options.

     -S saltfile
             When -K is used, specify the saltfile.  If the salt filename is
             not specified using -S, it defaults to image.slt.

     -t disktype
             Specify a disktype entry from the disktab(5) database.  The
             vnd_dev will have the sector size, sectors per track, and tracks
             per cylinder values of the specified disktype.  The defaults are
             512-byte sectors, 100 sectors per track and 1 track per cylinder.

     -u      vnconfig only.  Unconfigures a vnd_dev.

     -v      vnconfig only.  Print messages to stdout describing actions tak-
             en.

FILES
     /dev/{,r}{,s}vnd*

EXAMPLES
     Configure a CD-ROM or DVD image file as vnode disk svnd0 and mount the
     ISO 9660 file system contained in it:

           # vnconfig svnd0 /tmp/diskimage
           # mount -t cd9660 /dev/svnd0c /mnt

     Configure an encrypted image file as vnode disk svnd0 and mount the FFS
     file system contained in the `a' partition of the disklabel.  The encryp-
     tion key does not echo and must be entered every time the vnode disk is
     configured.

           # vnconfig -k svnd0 /tmp/cryptimg
           Encryption key:
           # mount /dev/svnd0a /mnt

     An equivalent fstab(5) entry is:

           /tmp/cryptimg /dev/svnd0c vnd rw,noauto,-k       0 0
           /dev/svnd0a   /mnt        ffs rw,noauto          0 0

     Same as above, but now configure the vnode using PKCS #5 PBKDF2 and a
     salt file with 20000 rounds:

           # vnconfig -K 20000 svnd0 /tmp/cryptimg
           Encryption key:
           Salt file: /tmp/cryptsalt
           # mount /dev/svnd0a /mnt

     An equivalent fstab(5) entry is:

           /tmp/cryptimg /dev/svnd0c vnd rw,noauto,-K=20000 0 0
           /dev/svnd0a   /mnt        ffs rw,noauto          0 0

     Unmount the file system and unconfigure the vnode device:

           # umount /mnt
           # vnconfig -u svnd0

     A sample of commands to put in rc.local(8) in order to have vnd images
     configured at boot time is listed here:

           # Example for automatically configuring a vnd device on startup
           echo "configuring vnd devices:"
           mount /dev/svnd0c
           fsck -p /dev/rsvnd0a
           mount /mnt

     Mounting images during the first pass of fsck(8) and mount(8) is not pos-
     sible, because the image to be configured to a vnd itself resides on a
     file system that first has to be checked and mounted.

SEE ALSO
     vnd(4), disktab(5), fstab(5), mount(8), swapon(8), umount(8)

HISTORY
     The mount_vnd command first appeared in OpenBSD 4.2.

AUTHORS
     David Krause.

CAVEATS
     The `c' partition of a vnd image should not be used.  When a superblock
     becomes damaged, fsck_ffs(8) needs information contained in the disklabel
     to determine the location of alternate superblocks.  This information is
     not available when directly using the `c' partition, so checking the file
     system image will fail.

OpenBSD 4.7                    February 15, 2009                             3
