configure vnode disks
vnconfig command configures vnode
pseudo disk devices. It will associate (or disassociate) the special file
vnd_dev with the regular file
image, allowing the latter to be accessed as though it
were a disk.
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.
defaults to the vnd0 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 devices 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:
vnconfigonly. Configures the device. If successful, references to vnd_dev will access the contents of image. This is the default operation.
- 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
-Soption. 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.
- Associate an encryption key with the device. All data will be encrypted using the Blowfish cipher before it is written to the disk.
vnconfigonly. List the vnd devices and indicate which ones are in use. If a specific vnd_dev is given, then only that one will be described.
mount_vndonly. Options are specified with a
-oflag followed by a comma separated string of options. See the mount(8) man page for possible options and their meanings.
At the moment,
-ois only here for compatibility reasons, but no use is made of supplied options.
-Kis used, specify the saltfile.
- 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.
vnconfigonly. Unconfigures a vnd_dev.
vnconfigonly. Print messages to stdout describing actions taken.
Configure a CD-ROM or DVD image file as vnode disk vnd0 and mount the ISO 9660 file system contained in it:
# vnconfig vnd0 /tmp/diskimage # mount -t cd9660 /dev/vnd0c /mnt
Configure an encrypted image file as vnode disk vnd0 and mount the FFS file system contained in the ‘a’ partition of the disklabel. The encryption key does not echo and must be entered every time the vnode disk is configured.
# vnconfig -k vnd0 /tmp/cryptimg Encryption key: # mount /dev/vnd0a /mnt
An equivalent fstab(5) entry is:
/tmp/cryptimg /dev/vnd0c vnd rw,noauto,-k 0 0 /dev/vnd0a /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 vnd0 /tmp/cryptimg Encryption key: Salt file: /tmp/cryptsalt # mount /dev/vnd0a /mnt
An equivalent fstab(5) entry is:
/tmp/cryptimg /dev/vnd0c vnd rw,noauto,-K=20000 0 0 /dev/vnd0a /mnt ffs rw,noauto 0 0
Unmount the file system and unconfigure the vnode device:
# umount /mnt # vnconfig -u vnd0
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/vnd0c fsck -p /dev/rvnd0a mount /mnt
Mounting images during the first pass of fsck(8) and mount(8) is not possible, because the image to be configured to a vnd itself resides on a file system that first has to be checked and mounted.
vnd(4), disktab(5), fstab(5), mount(8), swapon(8), umount(8)
mount_vnd command first appeared in
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.
Swapping to vnd devices is no longer supported.