vinum(8)

NAME
vinum - Logical Volume Manager control program

SYNOPSIS
vinum [command] [-options]

COMMANDS
create description-file
Create a volume as described in description-file
attach plex volume [rename] attach subdisk plex [offset] [rename]
Attach a plex to a volume, or a subdisk to a plex.
debug
Cause the volume manager to enter the kernel debugger.
debug flags
Set debugging flags.
detach [plex | subdisk]
Detach a plex or subdisk from the volume or plex to which it is attached.
info [-v]
List information about volume manager state.
init [-v]
Initialize a plex by writing zeroes to all its subdisks.
label volume
Create a volume label
list [-r] [-s] [-v] [-V] [volume | plex | subdisk]
List information about specified objects
l [-r] [-s] [-v] [-V] [volume | plex | subdisk]
List information about specified objects (alternative to list command)
ld [-r] [-s] [-v] [-V] [volume]
List information about drives
ls [-r] [-s] [-v] [-V] [subdisk]
List information about subdisks
lp [-r] [-s] [-v] [-V] [plex]
List information about plexes
lv [-r] [-s] [-v] [-V] [volume]
List information about volumes
makedev
Remake the device nodes in /dev/vinum.
quit
Exit the vinum program when running in interactive mode. Normally this would be done by entering the EOF character.
read disk [disk...]
Read the vinum configuration from the specified disks.
rename [-r] [drive | subdisk | plex | volume] newname
Change the name of the specified object.
resetconfig
Reset the complete vinum configuration.
resetstats [-r] [volume | plex | subdisk]
Reset statistisc counters for the specified objects, or for all objects if none are specified.
rm [-f] [-r] volume | plex | subdisk
Remove an object
setdaemon [value]
Set dæmon configuration.
start [volume | plex | subdisk]
Allow the system to access the objects
stop [-f] [volume | plex | subdisk]
Terminate access the objects

DESCRIPTION
vinum is a utility program to communicate with the Vinum logical volume manager. See vinum(4) for more information about the volume manager. vinum(8) is designed either for interactive use, when started without a command, or to execute a single command if the command is supplied as arguments to vinum. In interactive mode, vinum maintains a command line history.

  OPTIONS
vinum commands may optionally be followed by an option. Any of the following options may be specified with any command, but in some cases they do not make any difference: cases, the options are ignored. For example, the stop command ignores the -v and -V options.

-v  The -v option can be used with any command to request more detailed information.

-V  The -V option can be used with any command to request more detailed information than the -v option provides.

-f  The -f option overrides safety checks. Use with extreme care. This option is for emergency use only. For example, the command

        rm -f myvolume

    removes myvolume even if it is open. Any subsequent access to the volume will almost certainly cause a panic.

-r  The -r (``recursive'') option is used by the list commands to display information not only about the specified objects, but also about subordinate objects. For example, in conjnction with the lv command, the -r option will also show information about the plexes and subdisks belonging to the volume.

-s  The -s option is used by the list commands to display statistical information.

  COMMANDS IN DETAIL

vinum commands perform the following functions:

attach plex volume
    [rename]

attach subdisk plex [offset]
    [rename]

    vinum attach inserts the specified plex or subdisk in a volume or plex. In the case of a subdisk, an offset in the plex may be specified. If it is not, the subdisk will be attached at the first possible location. After attaching a plex to a non-empty volume, vinum reintegrates the plex.

    If the keyword rename is specified, vinum renames the object (and in the case of a plex, any subordinate subdisks) to fit in with the default vinum naming convention.

    A number of considerations apply to attaching subdisks:

    •   Subdisks can normally only be attached to concatenated plexes.

    •   If a striped or RAID-5 plex is missing a subdisk (for example after drive failure), it may be replaced by a subdisk of the same size only. No other attachment of subdisks is currently allowed.

    •   For concatenated plexes, the offset parameter specifies the offset in blocks from the beginning of the plex. For striped and RAID-5 plexes, it specifies the offset of the first block of the subdisk: in other words, the offset is the numerical position of the subdisk multiplied by the stripe size. For example, in a plex of block size 256k, the first subdisk will have offset 0, the second offset 256k, the third 512k, etc. This calculation ignores parity blocks in RAID-5 plexes.

create description-file

    vinum create is used to create any object. In view of the relatively complicated relationship and the potential dangers involved in creating a vinum object, there is no interactive interface to this function. See the section CONFIGURATION FILE below for more information.

debug

    vinum debug is used to enter the remote kernel debugger. It is only activated if vinum is built with the VINUMDEBUG option. This option will stop the execution of the operating system until the kernel debugger is exited. If remote debugging is set and there is no remote connection for a kernel debugger, it will be necessary to reset the system and reboot in order to leave the debugger.

debug
    flags

    Set a bit mask of internal debugging flags. These will change without warning as the product matures; to be certain, read the header file sys/dev/vinumvar.h. The bit mask is composed of the following values:

    DEBUG_ADDRESSES (1)
        Show buffer information during requests

    DEBUG_NUMOUTPUT (2)
        Show the value of vp->v_numoutput.

    DEBUG_RESID (4)
        Go into debugger in complete_rqe.

    DEBUG_LASTREQS (8)
        Keep a circular buffer of last requests.

    DEBUG_REVIVECONFLICT (16)
        Print info about revive conflicts.

    DEBUG_REMOTEGDB (256)
        Go into remote gdb when the debug command is issued.

detach [-f]
    plex

detach [-f]
    subdisk

    vinum detach removes the specified plex or subdisk from the volume or plex to which it is attached. If removing the object would impair the data integrity of the volume, the operation will fail unless the -f option is specified. If the object is named after the object above it (for example, subdisk vol1.p7.s0 attached to plex vol1.p7), the name will be changed by prepending the text ``ex-'' (for example, ex-vol1.p7.s0). If necessary, the name will be truncated in the process.

    detach does not reduce the number of subdisks in a striped or RAID-5 plex. Instead, the subdisk is marked absent, and can later be replaced with the attach command.

info
    vinum info displays information about vinum memory usage. This is intended primarily for debugging. With the -v option, it will give detailed information about the memory areas in use.

    With the -V option, info displays information about the last up to 64 I/O requests handled by the vinum driver. This information is only collected if debug flag 8 is set. The format looks like:

        vinum -> info -V
        Flags: 0x200    1 opens
        Total of 38 blocks malloced, total memory: 16460
        Maximum allocs:       56, malloc table at 0xf0f72dbc
        Time             Event       Buf        Dev     Offset          Bytes   SD      SDoff   Doffset Goffset
        14:40:00.637758 1VS Write 0xf2361f40    0x5b03  0x10            16384
        14:40:00.639280 2LR Write 0xf2361f40    0x5b03  0x10            16384
        14:40:00.639294 3RQ Read  0xf2361f40    0x427   0x104109        8192    19      0       0       0
        14:40:00.639455 3RQ Read  0xf2361f40    0x417   0xd2109         8192    17      0       0       0
        14:40:00.639529 3RQ Read  0xf2361f40    0x40f   0x6e109         8192    16      0       0       0
        14:40:00.652978 4DN Read  0xf2361f40    0x427   0x104109        8192    19      0       0       0
        14:40:00.667040 4DN Read  0xf2361f40    0x40f   0x6e109         8192    16      0       0       0
        14:40:00.668556 4DN Read  0xf2361f40    0x417   0xd2109         8192    17      0       0       0
        14:40:00.669777 6RP Write 0xf2361f40    0x427   0x104109        8192    19      0       0       0
        14:40:00.685547 4DN Write 0xf2361f40    0x427   0x104109        8192    19      0       0       0

    The Buf field always contains the address of the user buffer header. This can be used to identify the requests associated with a user request, though this is not 100% reliable: theoretically two requests in sequence could use the same buffer header, though this is not common. The beginning of a request can be identified by the event 1VS. The example above shows the requests involved in a single user request.

    The Event field contains information related to the sequence of events in the request chain. The digit 1 to 6 indicates the approximate sequence of events, and the two-letter abbreviation is a mnemonic for the location

    1VS (vinumstrategy) shows information about the user request on entry to vinumstrategy. The device number is the vinum device, and offset and length are the user parameters. This is always the beginning of a request sequence.

    2LR (launch_requests) shows the user request just prior to launching the low-level vinum requests in the function launch_requests. The parameters should be the same as in the 1VS information.

        In the following requests, Dev is the device number of the associated disk partition, Offset is the offset from the beginning of the partition, SD is the subdisk index in vinum_conf, SDoff is the offset from the beginning of the subdisk, Doffset is the offset of the associated data request, and Goffset is the offset of the associated group request, where applicable.

    3RQ (request) shows one of possibly several low-level vinum requests which are launched to satisfy the high-level request. This information is also logged in launch_requests.

    4DN (done) is called from complete_rqe, showing the completion of a request. This completion should match a request launched either at stage 4DN from launch_requests, or from complete_raid5_write at stage 5RD or 6RP.

    5RD (RAID-5 data) is called from complete_raid5_write and represents the data written to a RAID-5 data stripe after calculating parity.

    6RP (RAID-5 parity) is called from complete_raid5_write and represents the data written to a RAID-5 parity stripe after calculating parity.

init plex

    vinum init initializes a plex by writing zeroes to all its subdisks. This is the only way to ensure consistent data in a plex. You must perform this initialization before using a RAID-5 plex. It is also recommended for other new plexes.

    vinum initializes all subdisks of a plex in parallel. Since this operation can take a long time, it is performed in the background. vinum prints a console message when the initialization is complete.

label
    volume

    The label command writes a ufs style volume label on a volume. It is a simple alternative to an appropriate call to disklabel. This is needed because some ufs commands still read the disk to find the label instead of using the correct ioctl call to access it. vinum maintains a volume label separately from the volume data, so this command is not needed for newfs. This command is deprecated.

list
    [-r] [-V] [volume | plex | subdisk]

l   [-r] [-V] [volume | plex | subdisk]

ld  [-r] [-s] [-v] [-V] [volume]

ls  [-r] [-s] [-v] [-V] [subdisk]

lp  [-r] [-s] [-v] [-V] [plex]

lv  [-r] [-s] [-v] [-V] [volume]

    list is used to show information about the specified object. If the argument is omitted, information is shown about all objects known to vinum. The l command is a synonym for list.

    The -r option relates to volumes and plexes: if specified, it recursively lists information for the subdisks and (for a volume) plexes subordinate to the objects. The commands lv, lp, ls and ld commands list only volumes, plexes, subdisks and drives respectively. This is particularly useful when used without parameters.

    The -s option causes vinum to output device statistics, the [-v] (verbose) option causes some additional information to be output, and the [-V] causes considerable additional information to be output.

makedev
    The makedev command removes the directory /dev/vinum and recreates it with device nodes which reflect the current configuration. This command is not intended for general use, and is provided for emergency use only.

quit
    Exit the vinum program when running in interactive mode. Normally this would be done by entering the EOF character.

read
    disk [disk...]

    The read command scans the specified disks for vinum partitions containing previously created configuration information. It reads the configuration in order from the most recently updated to least recently updated configuration. This is the normal method used to start vinum. vinum maintains an up-to-date copy of all configuration information on each disk partition. You must specify all of the partitions in a configuration as the parameter to this command. vinum read will accept the names of non-Vinum partitions, so you can specify all partitions upon which a vinum partition might be resident to this command.

rename
    [-r] [drive | subdisk | plex | volume] newname

    Change the name of the specified object. If the -r option is specified, subordinate objects will be named by the default rules: plex names will be formed by appending .pnumber to the volume name, and subdisk names will be formed by appending .snumber to the plex name.

replace
    [subdisk | plex] newobject

    Replace the object with an identical other object. This command has not yet been implemented.

resetconfig

    The resetconfig command completely obliterates the vinum configuration on a system. Use this command only when you want to completely delete the configuration. vinum will ask for confirmation: you must type in the words NO FUTURE exactly as shown:

        # vinum resetconfig
        WARNING!  This command will completely wipe out your vinum
        configuration.  All data will be lost.  If you really want
        to do this, enter the text
        NO FUTURE
        Enter text -> NO FUTURE
        Vinum configuration obliterated

    As the message suggests, this is a last-ditch command. Don't use it unless you have an existing configuration which you never want to see again.

resetstats
    [-r] [volume | plex | subdisk]

    vinum maintains a number of statistical counters for each object. See the header file for more information. Use the resetstats command to reset these counters. In conjunction with the -r option, vinum also resets the counters of subordinate objects.

rm  [-f] [-r] volume | plex | subdisk

    rm removes an object from the vinum configuration. Once an object has been removed, there is no way to recover it. Normally vinum performs a large amount of consistency checking before removing an object. The -f option tells vinum to omit this checking and remove the object anyway. Use this option with great care: it can result in total loss of data on a volume.

    Normally, vinum refuses to remove a volume or plex if it has subordinate plexes or subdisks respectively. You can tell vinum to remove the object anyway by using the -f flag, or you can cause vinum to remove the subordinate objects as well by using the -r (recursive) flag. If you remove a volume with the -r flag, it will remove both the plexes and the subdisks which belong to the plexes.

setdaemon
    [value]

    setdaemon sets a variable bitmask for the vinum dæmon. This command is temporary and will be replaced. Currently, the bit mask may contain the bits 1 (log every action to syslog) and 4 (don't update configuration). Option bit 4 can be useful for error recovery.

start
    [volume | plex | subdisk]

    start starts one or more vinum objects. To start a plex in a multi-plex volume, the data must be copied from another plex in the volume. This frequently takes a long time and is done in the background.

stop
    [-f] [volume | plex | subdisk]

    stop disables access to the specified objects and any subordinate objects. It does not remove the objects from the configuration. They can be accessed again after a start command.

    By default, vinum does not remove active objects. For example, you cannot remove a plex which is attached to an active volume, and you cannot remove a volume which is open. The -f option tells vinum to omit this checking and remove the object anyway. Use this option with great care and understanding: used incorrectly, it can result in serious data corruption.

  CONFIGURATION FILE
vinum requires that all parameters to the create commands must be in a configuration file. Entries in the configuration file define volumes, plexes and subdisks, and may be in free format, except that each entry must be on a single line.

Some configuration file parameters specify a size (lengths, stripe sizes). These lengths can be specified as bytes, as sectors of 512 bytes (by appending the letter b), as kilobytes (by appending the letter k), as megabytes (by appending the letter m) or as gigabytes (by appending the letter g). These quantities represent the values 2**10, 2**20 and 2**30 respectively. For example, the value 16777216 bytes can also be written as 16m, 16384k or 32768b.

The configuration file can contain the following entries:

volume
    name [options]

    Define a volume with name name.

    Options are:

    plex plexname
        Add the specified plex to the volume. If plexname is specified as *, vinum will look for the definition of the plex as the next possible entry in the configuration file after the definition of the volume.

    readpol policy
        Define a read policy for the volume. policy may be either round or prefer plexname. vinum satisfies a read request from only one of the plexes. A round read policy specifies that each read should be performed from a different plex in round-robin fashion. A prefer read policy reads from the specified plex every time.

    setupstate
        When creating a multi-plex volume, assume that the contents of all the plexes are consistent. This is normally not the case, and correctly you should use the init command to first bring them to a consistent state. In the case of striped and concatenated plexes, however, it does not normally cause problems to leave them inconsistent: when using a volume for a file system or a swap partition, the previous contents of the disks are not of interest, so they may be ignored. If you want to take this risk, use this keyword. It will only apply to the plexes defined immediately after the volume in the configuration file. If you add plexes to a volume at a later time, you must integrate them.

        Note that you must use the init command with RAID-5 plexes: otherwise extreme data corruption will result if one subdisk fails.

plex [options]

    Define a plex. Unlike a volume, a plex does not need a name. The options may be:

    name plexname
        Specify the name of the plex. Note that you must use the keyword name when naming a plex or subdisk.

    org organization [stripesize]

        Specify the organization of the plex. organization can be one of concat, striped or raid5. For striped and raid5 plexes, the parameter stripesize must be specified, while for concat it must be omitted. For type striped, it specifies the width of each stripe. For type raid5, it specifies the size of a group. A group is a portion of a plex which stores the parity bits all in the same subdisk. It must be a factor of the plex size (in other words, the result of dividing the plex size by the stripe size must be an integer), and it must be a multiple of a disk sector (512 bytes).

        For optimum performance, stripes should be at least 128 kB in size: anything smaller will result in a significant increase in I/O activity due to mapping of individual requests over multiple disks. The increase in concurrency due to this mapping will not make up for the increase in latency. A good guideline for stripe size is between 256 kB and 512 kB.

        A striped plex must have at least two subdisks (otherwise it is a concatenated plex), and each must be the same size. A RAID-5 plex must have at least three subdisks, and each must be the same size. In practice, a RAID-5 plex should have at least 5 subdisks.

    volume volname
        Add the plex to the specified volume. If no volume keyword is specified, the plex will be added to the last volume mentioned in the configuration file.

    sd sdname offset
        Add the specified subdisk to the plex at offset offset.

subdisk [options]

    Define a subdisk. Options may be:

    name name
        Specify the name of a subdisk.  It is not necessary to specify a name for a
        subdisk—see OBJECT NAMING above.  Note that you must specify the keyword
        name
        if you wish to name a subdisk.

    plexoffset offset
        Specify the starting offset of the subdisk in the plex.  If not specified,
        vinum
        allocates the space immediately after the previous subdisk, if any, or otherwise
        at the beginning of the plex.

    driveoffset offset
        Specify the starting offset of the subdisk in the drive.  If not specified,
        vinum
        allocates the first contiguous
        length
        bytes of free space on the drive.

    length length
        Specify the length of the subdisk.  This keyword must be specified.  There is no
        default.
        length
        may be shortened to
        len.

    plex plex
        Specify the plex to which the subdisk belongs.  By default, the subdisk belongs
        to the last plex specified.

    drive drive
        Specify the drive on which the subdisk resides.  By default, the subdisk resides
        on the last drive specified.

drive name [options]

    Define a drive. The option must be:

    device devicename
        Specify the device on which the drive resides.

EXAMPLE CONFIGURATION FILE

    # Sample vinum configuration file
    #
    # Our drives
    drive drive1 device /dev/da1h
    drive drive2 device /dev/da2h
    drive drive3 device /dev/da3h
    drive drive4 device /dev/da4h
    drive drive5 device /dev/da5h
    drive drive6 device /dev/da6h
    # A volume with one striped plex
    volume tinyvol
     plex org striped 32b
      sd length 64m drive drive2
      sd length 64m drive drive4
    volume stripe
     plex org striped 32b
      sd length 512m drive drive2
      sd length 512m drive drive4
    # Two plexes
    volume concat
     plex org concat
      sd length 100m drive drive2
      sd length 50m drive drive4
     plex org concat
      sd length 150m drive drive4
    # A volume with one striped plex and one concatenated plex
    volume strcon
     plex org striped 32b
      sd length 100m drive drive2
      sd length 100m drive drive4
     plex org concat
      sd length 150m drive drive2
      sd length 50m drive drive4
    # a volume with a  RAID-5 and a striped plex
    # note that the RAID-5 volume is longer by
    # the length of one subdisk
    volume vol5
     plex org striped 64k
      sd length 1000m drive drive2
      sd length 1000m drive drive4
     plex org raid5 32k
      sd length 500m drive drive1
      sd length 500m drive drive2
      sd length 500m drive drive3
      sd length 500m drive drive4
      sd length 500m drive drive5

  DRIVE LAYOUT CONSIDERATIONS
vinum drives are currently BSD disk partitions. They must be of type unused in order to avoid overwriting file systems. In later versions of vinum this requirement will change to type vinum. Use disklabel -e to edit a partition type definition. The following display shows a typical partition layout as shown by disklabel:

    8 partitions:
    #        size   offset    fstype   [fsize bsize bps/cpg]
      a:    81920   344064    4.2BSD        0     0     0   # (Cyl.  240*- 297*)
      b:   262144    81920      swap                        # (Cyl.   57*- 240*)
      c:  4226725        0    unused        0     0         # (Cyl.    0 - 2955*)
      e:    81920        0    4.2BSD        0     0     0   # (Cyl.    0 - 57*)
      f:  1900000   425984    4.2BSD        0     0     0   # (Cyl.  297*- 1626*)
      g:  1900741  2325984    unused        0     0     0   # (Cyl. 1626*- 2955*)

In this example, partition g may be used as a vinum partition. Partitions a, e and f may be used as UFS file systems or ccd partitions. Partition b is a swap partition, and partition c represents the whole disk and should not be used for any other purpose.

vinum uses the first 265 sectors on each partition for configuration information, so the maximum size of a subdisk is 265 sectors smaller than the drive.

GOTCHAS
The following points are not bugs, and they have good reasons for existing, but they have shown to cause confusion. Each is discussed in the appropriate section above.

1.  vinum will not create a device on UFS partitions. Instead, it will return an error message ``wrong partition type''. The partition type must currently be ``unused''.

2.  When you create a volume with multiple plexes, vinum does not automatically initialize the plexes. This means that the contents are not known, but they are certainly not consistent. As a result, by default vinum sets the state of all newly-created plexes except the first to stale.

    In practice, people aren't too interested in what was in the plex when it was created, and other volume managers cheat by setting them up anyway. vinum provides two ways to ensure that newly created plexes are up:

    •   Create the plexes and then initialize them with vinum init.

    •   Create the volume (not the plex) with the keyword setupstate, which tells vinum to ignore any possible inconsistency and set the plexes to be up.

3.  Some of the commands currently supported by vinum are not really needed. For reasons which I don't understand, however, I find that users frequently try the label and resetconfig commands, though especially resetconfig outputs all sort of dire warnings. Don't use these commands unless you have a good reason to do so.

4.  Some state transitions are not very intuitive. In fact, it's not clear whether this is a bug or a feature. If you find that you can't start an object in some strange state, such as a reborn subdisk, try first to get it into stopped state, with the stop or stop -f commands. If that works, you should then be able to start it. If you find that this is the only way to get out of a position where easier methods fail, please report the situation.

5.  If you build the kernel module with the -DVINUMDEBUG option, you must also build vinum(8) with the -DVINUMDEBUG option, since the size of some data objects used by both components depends on this option. If you don't do so, commands will fail with the message Invalid argument, and a console message will be logged such as

        vinumioctl: invalid ioctl from process 247 (vinum): c0e44642

    This error may also occur if you use old versions of kld or userland program.

FILES
/dev/vinum - directory with device nodes for vinum objects.
/dev/vinum/control - control device for vinum
/dev/vinum/plex - directory containing device nodes for vinum plexes.
/dev/vinum/sd - directory containing device nodes for vinum subdisks.

SEE ALSO
vinum(4), disklabel(8), http://www.lemis.com/vinum.html, http://www.lemis.com/vinum-debugging.html.

AUTHOR
Greg Lehey <grog@lemis.com>.

HISTORY
The vinum command first appeared in FreeBSD 3.0.