vn(4) RFC Misc.

Chris Turner c.turner at
Sat Dec 22 12:46:30 PST 2007

Hello all. Hope this isn't too much to digest in one posting :)

Since DragonFly has gotten vkernel and new disklabels, Matt is working
on the HAMMER, vinum is unfortunately getting some in-tree bit rot, etc.
I'm sure everyone in df land is thinking / using / testing storage
related things in some capacity ..
In particular, I've been using lots of vn(4) disks, and trying
to keep track of which one goes where and gets assigned to what
vn device is a pain.
I know there is /etc/vntab, but it's always seemed a bit
cumbersome to me, either by having to maintain separate vntabs
for different sets of devices, or keeping vntab in synch with
fstab, etc.
Plus there's been some talk of growing support for secure storage,
which got me looking at the different way's vn's are being used
in all the BSDs.
I started to port over the OpenBSD 'mount_vnd' support in an effort
to work on '-K' and '-l' support, but was getting to the point where
it would be possibly a bit more work than I wanted to do without
support, so I thought I'd summarize things & send a note.
( that and this seemed more 'doable' than a vkernel.conf by
  the next release :)
anyhow, I'd like to start working on the stuff in 'comments',
but wanted to see what the reaction would be from the group
before I did (e.g. other things could be trimmed, etc).

- Chris



  - rework vn to make it easier to use
  - glean useful features from others in the process
  - do some possible cleanup in the process
current state of the art as of 2007-12-22:

  - df vn: fb4 legacy vn - supports a 'vntab' w auto-mounting
    unsure of use w/r/t buffer cache as noted in open
  - fb5+? vn: utilities merged with md(4) and uses new 'mdconfig -f'
    userland utility. mount_mfs replaced by mdmfs += mount_mfs
    wrapper which creates, labels & formats, but also does vn disks.
    from the manual, mount_mfs appears to always format, so not sure how
    useful it is for multi-use vn's. Seems like overkill IMHO. Mdconfig
    has '-l' but uses GEOM.
  - ob vn: nb legacy raw or via buffer cache vn += blowfish, added
    mount_vnd interface as hardlink, which permits fstab usage,
  - nb vn: nb raw vn += compression, '-l' support. Still have to vnconfig
    and then mount.
comparing vn related utilities:

 df: (vnconfig)
   -a Read a command file and performs the specified actions for each
   -c Configure the device.  If successful, references to special_file
   -d Disable (if possible) the specified feature.
   -e Configure the device and enables any feature that was specified.
   -f config_file
   -g Fiddle global options.
   -r flag
   -s flag
   -S value{k,m,g,t}
   -T When a regular file is specified, VN will ftruncate() the file to
   -Z When a regular file is specified, VN will zero the contents of
   -u Disable and ``unconfigure'' the device.
   -v Print messages to stdout describing actions taken.
   features: (for -e)
     swap    Swapping is enabled on the special file.  See swapon(2).
ob: (vnconfig / mount_vnd)
  -c vnconfig only.  Configures the device.  If successful, references
  -K rounds
  -k Associate an encryption key with the device.  All data will be
  -l vnconfig only.  List the (s)vnd devices and indicate which ones
  -o options (mount_vnd only.)
  -S saltfile
  -u vnconfig only.  Unconfigures a vnd_dev.
  -v vnconfig only.  Print messages to stdout describing actions
nb: (vnconfig)
  -c Configures the device.  If successful, references to vnode_disk
  -F Force unconfiguration if the device is in use. Doesnt imply '-u'
  -f disktab
  -l List the vnd devices and indicate which ones are in use.
  -r Configure the device as read-only.
  -u Unconfigures the device.
  -v Print messages to stdout describing actions taken.
  -z Assume that regular_file is a compressed disk image in cloop2
fb: (mdconfig)
  -a Attach a memory disk.  This will configure and attach a memory
  -d Detach a memory disk from the system and release all resources.
  -t type (malloc|vnode|swap)
  -f file Filename to use for the vnode type memory disk.
  -l List configured devices.  If given with -u, display details about
     that particular device
  -n When printing md device names, print only the unit number without
     the md prefix
  -s size Size of the memory disk.
  -S sectorsize
  -x sectors/track
  -y heads/cylinder
  -o [no]option (async|reserve|cluster|compress|force|readonly)
  -u unit

  thinking best, simplist combination of above features in order
  of priority / implementation desire & ease:
  - add mount_vnd interface to vnconfig, wipe vntab use
  - add '-l' support infrastructure (basically 1 ioctl, VNDIOCGET)
  - add keyed support per open
  - add compressed support per net
  - possibly move common label / device file expansion, etc related misc.
    into -lutil in process for use by other storage related code.
  This perhaps could lead to e.g. mount_ccd, etc types of things to
  simplify storage configuration, if that makes sense to do.


Chris Turner                                     199Technologies, LLC.
c.turner at

More information about the Kernel mailing list