VINUM(8) FreeBSD System Manager's Manual VINUM(8) NNAAMMEE vviinnuumm - Logical Volume Manager control program SSYYNNOOPPSSIISS vviinnuumm [_c_o_m_m_a_n_d] [--ooppttiioonnss] CCOOMMMMAANNDDSS aattttaacchh _p_l_e_x _v_o_l_u_m_e [rreennaammee] aattttaacchh _s_u_b_d_i_s_k _p_l_e_x [_o_f_f_s_e_t] [rreennaammee] Attach a plex to a volume, or a subdisk to a plex. cchheecckkppaarriittyy _p_l_e_x [--ff] [--vv] Check the parity blocks of a RAID-4 or RAID-5 plex. ccoonnccaatt [--ff] [--nn _n_a_m_e] [--vv] _d_r_i_v_e_s Create a concatenated volume from the specified drives. ccrreeaattee [--ff] _d_e_s_c_r_i_p_t_i_o_n_-_f_i_l_e Create a volume as described in _d_e_s_c_r_i_p_t_i_o_n_-_f_i_l_e. ddeebbuugg Cause the volume manager to enter the kernel debugger. ddeebbuugg _f_l_a_g_s Set debugging flags. ddeettaacchh [--ff] [_p_l_e_x | _s_u_b_d_i_s_k] Detach a plex or subdisk from the volume or plex to which it is attached. dduummppccoonnffiigg [_d_r_i_v_e _._._.] List the configuration information stored on the specified drives, or all drives in the system if no drive names are speci- fied. iinnffoo [--vv] [--VV] [--VVVV] [--VVVVVV] List information about volume manager state. iinniitt [--SS _s_i_z_e] [--ww] _p_l_e_x | _s_u_b_d_i_s_k Initialize the contents of a subdisk or all the subdisks of a plex to all zeros. ll | lliisstt [--rr] [--ss] [--vv] [--VV] [_v_o_l_u_m_e | _p_l_e_x | _s_u_b_d_i_s_k] List information about specified objects. lldd [--rr] [--ss] [--vv] [--VV] [_d_r_i_v_e] List information about drives. llss [--rr] [--ss] [--vv] [--VV] [_s_u_b_d_i_s_k] List information about subdisks. llpp [--rr] [--ss] [--vv] [--VV] [_p_l_e_x] List information about plexes. llvv [--rr] [--ss] [--vv] [--VV] [_v_o_l_u_m_e] List information about volumes. mmaakkeeddeevv Remake the device nodes in _/_d_e_v_/_v_i_n_u_m. mmiirrrroorr [--ff] [--nn _n_a_m_e] [--ss] [--vv] _d_r_i_v_e_s Create a mirrored volume from the specified drives. mmoovvee | mmvv --ff _d_r_i_v_e _o_b_j_e_c_t _._._. Move the object(s) to the specified drive. pprriinnttccoonnffiigg [_f_i_l_e] Write a copy of the current configuration to _f_i_l_e. qquuiitt Exit the vviinnuumm utility when running in interactive mode. Nor- mally this would be done by entering the EOF character. rreeaadd _d_i_s_k _._._. Read the vviinnuumm configuration from the specified disks. rreennaammee [--rr] [_d_r_i_v_e | _s_u_b_d_i_s_k | _p_l_e_x | _v_o_l_u_m_e] _n_e_w_n_a_m_e Change the name of the specified object. rreebbuuiillddppaarriittyy _p_l_e_x [--ff] [--vv] [--VV] Rebuild the parity blocks of a RAID-4 or RAID-5 plex. rreesseettccoonnffiigg Reset the complete vviinnuumm configuration. This should never be needed. rreesseettssttaattss [--rr] [_v_o_l_u_m_e | _p_l_e_x | _s_u_b_d_i_s_k] Reset statistics counters for the specified objects, or for all objects if none are specified. rrmm [--ff] [--rr] _v_o_l_u_m_e | _p_l_e_x | _s_u_b_d_i_s_k Remove an object. ssaavveeccoonnffiigg Save vviinnuumm configuration to disk after configuration failures. sseettddaaeemmoonn [_v_a_l_u_e] Set daemon configuration. sseettssttaattee _s_t_a_t_e [_v_o_l_u_m_e | _p_l_e_x | _s_u_b_d_i_s_k | _d_r_i_v_e] Set state without influencing other objects, for diagnostic pur- poses only. ssttaarrtt Read configuration from all vinum drives. ssttaarrtt [--ii _i_n_t_e_r_v_a_l] [--SS _s_i_z_e] [--ww] _v_o_l_u_m_e | _p_l_e_x | _s_u_b_d_i_s_k Bring the specified objects into the _u_p state. ssttoopp [--ff] [_v_o_l_u_m_e | _p_l_e_x | _s_u_b_d_i_s_k] Terminate access to the objects, or stop vviinnuumm if no parameters are specified. vviinnuumm can only be stopped if it is loaded as a LKM. ssttrriippee [--ff] [--nn _n_a_m_e] [--vv] _d_r_i_v_e_s Create a striped volume from the specified drives. DDEESSCCRRIIPPTTIIOONN The vviinnuumm utility communicates with the kernel component of the Vinum logical volume manager. It is designed either for interactive use, when started without command line arguments, or to execute a single command if the command is supplied on the command line. In interactive mode, vviinnuumm maintains a command line history. OOPPTTIIOONNSS vviinnuumm commands may optionally be followed by an option. Any of the fol- lowing options may be specified with any command, but in some cases the options are ignored. For example, the ssttoopp command ignores the --vv and --VV options. --ff The --ff (``force'') option overrides safety checks. Use with care. For most options, this option is for emergency use only, and it is possible to cause a panic after abuse of this flag. --ii _m_i_l_l_i_s_e_c_s When performing the iinniitt and ssttaarrtt commands, wait _m_i_l_l_i_s_e_c_s mil- liseconds between copying each block. This lowers the load on the system. --nn _n_a_m_e Use the --nn option to specify a volume name to the simplified con- figuration commands ccoonnccaatt, mmiirrrroorr and ssttrriippee. --rr The --rr (``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 conjunction with the llvv command, the --rr option will also show information about the plexes and subdisks belonging to the volume. --ss The --ss (``statistics'') option is used by the list commands to display statistical information. The mmiirrrroorr command also uses this option to specify that it should create striped plexes. --SS _s_i_z_e The --SS option specifies the transfer size for the iinniitt and ssttaarrtt commands. --vv The --vv (``verbose'') option can be used to request more detailed information. --VV The --VV (``Very verbose'') option can be used to request more detailed information than the --vv option provides. In some cases, multiple use of this option can increase verbosity still further. --ww The --ww (``wait'') option tells vviinnuumm to wait for completion of commands which normally run in the background, such as iinniitt. CCOOMMMMAANNDDSS IINN DDEETTAAIILL vviinnuumm commands perform the following functions: aattttaacchh _p_l_e_x _v_o_l_u_m_e [rreennaammee] aattttaacchh _s_u_b_d_i_s_k _p_l_e_x [_o_f_f_s_e_t] [rreennaammee] vviinnuumm aattttaacchh 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, vviinnuumm reintegrates the plex. If the keyword rreennaammee is specified, vviinnuumm renames the object (and in the case of a plex, any subordinate subdisks) to fit in with the default vviinnuumm naming convention. To rename the object to any other name, use the rreennaammee command. A number of considerations apply to attaching subdisks: ++oo Subdisks can normally only be attached to concatenated plexes. ++oo If a striped, RAID-4 or RAID-5 plex is missing a subdisk (for example after drive failure), it should be replaced by a sub- disk of the same size only. ++oo In order to add further subdisks to a striped, RAID-4 or RAID-5 plex, use the --ff (force) option. This will corrupt the data in the plex. ++oo For concatenated plexes, the _o_f_f_s_e_t parameter specifies the offset in blocks from the beginning of the plex. For striped, RAID-4 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 with stripe size 496k, the first subdisk will have offset 0, the second offset 496k, the third 992k, etc. This calculation ignores parity blocks in RAID-4 and RAID-5 plexes. cchheecckkppaarriittyy _p_l_e_x [--ff] [--vv] Check the parity blocks on the specified RAID-4 or RAID-5 plex. This operation maintains a pointer in the plex, so it can be stopped and later restarted from the same position if desired. In addition, this pointer is used by the rreebbuuiillddppaarriittyy command, so rebuilding the parity blocks need only start at the location where the first parity problem has been detected. If the --ff flag is specified, cchheecckkppaarriittyy starts checking at the beginning of the plex. If the --vv flag is specified, cchheecckkppaarriittyy prints a running progress report. ccoonnccaatt [--ff] [--nn _n_a_m_e] [--vv] _d_r_i_v_e_s The ccoonnccaatt command provides a simplified alternative to the ccrreeaattee command for creating volumes with a single concatenated plex. The largest contiguous space available on each drive is used to create the subdisks for the plexes. Normally, the ccoonnccaatt command creates an arbitrary name for the volume and its components. The name is composed of the text ``vinum'' and a small integer, for example ``vinum3''. You can override this with the --nn _n_a_m_e option, which assigns the name specified to the volume. The plexes and subdisks are named after the volume in the default manner. There is no choice of name for the drives. If the drives have already been initialized as vviinnuumm drives, the name remains. Oth- erwise the drives are given names starting with the text ``vinumdrive'' and a small integer, for example ``vinumdrive7''. As with the ccrreeaattee command, the --ff option can be used to specify that a previous name should be overwritten. The --vv is used to specify verbose output. See the section _S_I_M_P_L_I_F_I_E_D _C_O_N_F_I_G_U_R_A_T_I_O_N below for some examples of this command. ccrreeaattee [--ff] [_d_e_s_c_r_i_p_t_i_o_n_-_f_i_l_e] vviinnuumm ccrreeaattee is used to create any object. In view of the rela- tively complicated relationship and the potential dangers involved in creating a vviinnuumm object, there is no interactive interface to this function. If you do not specify a file name, vviinnuumm starts an editor on a temporary file. If the environment variable EDITOR is set, vviinnuumm starts this editor. If not, it defaults to vvii. See the section _C_O_N_F_I_G_U_R_A_T_I_O_N _F_I_L_E below for more information on the format of this file. Note that the vviinnuumm ccrreeaattee function is additive: if you run it multiple times, you will create multiple copies of all unnamed objects. Normally the ccrreeaattee command will not change the names of existing vviinnuumm drives, in order to avoid accidentally erasing them. The correct way to dispose of no longer wanted vviinnuumm drives is to reset the configuration with the rreesseettccoonnffiigg command. In some cases, however, it may be necessary to create new data on vviinnuumm drives which can no longer be started. In this case, use the ccrreeaattee --ff command. ddeebbuugg This command is activated only if vviinnuumm is built with the VINUMDEBUG option. vviinnuumm ddeebbuugg, without any arguments, is used to enter the kernel debugger. 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. ddeebbuugg _f_l_a_g_s Set a bit mask of internal debugging flags. These will change without warning as the product matures; to be certain, read the header file <_s_y_s_/_d_e_v_/_v_i_n_u_m_v_a_r_._h>. The bit mask is composed of the following values: DEBUG_ADDRESSES (1) Show buffer information during requests DEBUG_RESID (4) Go into debugger in ccoommpplleettee__rrqqee(). DEBUG_LASTREQS (8) Keep a circular buffer of last requests. DEBUG_REVIVECONFLICT (16) Print info about revive conflicts. DEBUG_EOFINFO (32) Print information about internal state when returning an EOF on a striped plex. DEBUG_MEMFREE (64) Maintain a circular list of the last memory areas freed by the memory allocator. DEBUG_REMOTEGDB (256) Go into remote ggddbb when the ddeebbuugg command is issued. DEBUG_WARNINGS (512) Print some warnings about minor problems in the implemen- tation. ddeettaacchh [--ff] _p_l_e_x ddeettaacchh [--ff] _s_u_b_d_i_s_k vviinnuumm ddeettaacchh removes the specified plex or subdisk from the vol- ume 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 --ff 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. ddeettaacchh does not reduce the number of subdisks in a striped, RAID-4 or RAID-5 plex. Instead, the subdisk is marked absent, and can later be replaced with the aattttaacchh command. dduummppccoonnffiigg [_d_r_i_v_e _._._.] Show the configuration information stored on the specified drives. If no drive names are specified, dduummppccoonnffiigg searches all drives on the system for Vinum partitions and dumps the informa- tion. If configuration updates are disabled, it is possible that this information is not the same as the information returned by the lliisstt or pprriinnttccoonnffiigg commands. This command is used primarily for maintenance and debugging. iinnffoo Display information about vviinnuumm memory usage or requests. This is intended primarily for debugging. With the --vv option, it gives detailed information about the memory areas in use. With the --VV option, iinnffoo displays information about the last up to 128 I/O requests handled by the vviinnuumm driver. This informa- tion 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 91.3 0x10 16384 14:40:00.639280 2LR Write 0xf2361f40 91.3 0x10 16384 14:40:00.639294 3RQ Read 0xf2361f40 4.39 0x104109 8192 19 0 0 0 14:40:00.639455 3RQ Read 0xf2361f40 4.23 0xd2109 8192 17 0 0 0 14:40:00.639529 3RQ Read 0xf2361f40 4.15 0x6e109 8192 16 0 0 0 14:40:00.652978 4DN Read 0xf2361f40 4.39 0x104109 8192 19 0 0 0 14:40:00.667040 4DN Read 0xf2361f40 4.15 0x6e109 8192 16 0 0 0 14:40:00.668556 4DN Read 0xf2361f40 4.23 0xd2109 8192 17 0 0 0 14:40:00.669777 6RP Write 0xf2361f40 4.39 0x104109 8192 19 0 0 0 14:40:00.685547 4DN Write 0xf2361f40 4.39 0x104109 8192 19 0 0 0 11:11:14.975184 Lock 0xc2374210 2 0x1f8001 11:11:15.018400 7VS Write 0xc2374210 0x7c0 32768 10 11:11:15.018456 8LR Write 0xc2374210 13.39 0xcc0c9 32768 11:11:15.046229 Unlock 0xc2374210 2 0x1f8001 The _B_u_f 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: theoreti- cally 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 _1_V_S or _7_V_S. The first example above shows the requests involved in a user request. The second is a subdisk I/O request with locking. The _E_v_e_n_t 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 vviinnuummssttrraatteeggyy(). The device number is the vviinnuumm 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 vviinnuumm requests in the function llaauunncchh__rreeqquueessttss(). The parameters should be the same as in the _1_V_S information. In the following requests, _D_e_v is the device number of the asso- ciated disk partition, _O_f_f_s_e_t is the offset from the beginning of the partition, _S_D is the subdisk index in _v_i_n_u_m___c_o_n_f, _S_D_o_f_f is the offset from the beginning of the subdisk, _D_o_f_f_s_e_t is the off- set of the associated data request, and _G_o_f_f_s_e_t is the offset of the associated group request, where applicable. 3RQ (request) shows one of possibly several low-level vviinnuumm requests which are launched to satisfy the high-level request. This information is also logged in llaauunncchh__rreeqquueessttss(). 4DN (done) is called from ccoommpplleettee__rrqqee(), showing the com- pletion of a request. This completion should match a request launched either at stage _4_D_N from llaauunncchh__rreeqquueessttss(), or from ccoommpplleettee__rraaiidd55__wwrriittee() at stage _5_R_D or _6_R_P. 5RD (RAID-5 data) is called from ccoommpplleettee__rraaiidd55__wwrriittee() and represents the data written to a RAID-4 or RAID-5 data stripe after calculating parity. 6RP (RAID-5 parity) is called from ccoommpplleettee__rraaiidd55__wwrriittee() and represents the data written to a RAID-4 or RAID-5 parity stripe after calculating parity. 7VS shows a subdisk I/O request. These requests are usu- ally internal to vviinnuumm for operations like initializa- tion or rebuilding plexes. 8LR shows the low-level operation generated for a subdisk I/O request. Lockwait specifies that the process is waiting for a range lock. The parameters are the buffer header associated with the request, the plex number and the block number. For internal reasons the block number is one higher than the address of the beginning of the stripe. Lock specifies that a range lock has been obtained. The parameters are the same as for the range lock. Unlock specifies that a range lock has been released. The parameters are the same as for the range lock. To measure response times, use more than one --VV option. If two are specified, the printout includes the time in microseconds since the previous stage in the request. If three are specified, only the time between issuing the request to the disk driver and the response is measured. iinniitt [--SS _s_i_z_e] [--ww] _p_l_e_x | _s_u_b_d_i_s_k vviinnuumm iinniitt initializes a subdisk by writing blocks of binary zeroes to the entire subdisk. You can initialize all subdisks in a plex by specifying the plex name. This is the only way to ensure consistent data in a plex. You must perform this initial- ization before using a RAID-4 or RAID-5 plex. vviinnuumm initializes all subdisks of a plex in parallel. Since this operation can take a long time, it is normally performed in the background. If you want to wait for completion of the command, use the --ww (wait) option. Specify the --SS option if you want to write blocks of a different size from the default value of 64 kB. vviinnuumm prints a console message when the initialization is complete. llaabbeell _v_o_l_u_m_e The llaabbeell command writes a _u_f_s style volume label on a volume. It is a simple alternative to an appropriate call to ddiisskkllaabbeell. This is needed because some _u_f_s commands still read the disk to find the label instead of using the correct ioctl(2) call to access it. vviinnuumm maintains a volume label separately from the volume data, so this command is not needed for newfs(8). This command is deprecated. lliisstt [--rr] [--VV] [_v_o_l_u_m_e | _p_l_e_x | _s_u_b_d_i_s_k] ll [--rr] [--VV] [_v_o_l_u_m_e | _p_l_e_x | _s_u_b_d_i_s_k] lldd [--rr] [--ss] [--vv] [--VV] [_v_o_l_u_m_e] llss [--rr] [--ss] [--vv] [--VV] [_s_u_b_d_i_s_k] llpp [--rr] [--ss] [--vv] [--VV] [_p_l_e_x] llvv [--rr] [--ss] [--vv] [--VV] [_v_o_l_u_m_e] lliisstt is used to show information about the specified object. If the argument is omitted, information is shown about all objects known to vviinnuumm. The ll command is a synonym for lliisstt. The --rr 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 llvv, llpp, llss and lldd list only volumes, plexes, subdisks and drives respectively. This is particularly useful when used without parameters. The --ss option causes vviinnuumm to output device statistics, the --vv (verbose) option causes some additional information to be output, and the --VV causes considerable additional information to be out- put. mmaakkeeddeevv The mmaakkeeddeevv command removes the directory _/_d_e_v_/_v_i_n_u_m and recre- ates it with device nodes which reflect the current configura- tion. This command is not intended for general use, and is pro- vided for emergency use only. mmiirrrroorr [--ff] [--nn _n_a_m_e] [--ss] [--vv] _d_r_i_v_e_s The mmiirrrroorr command provides a simplified alternative to the ccrreeaattee command for creating mirrored volumes. Without any options, it creates a RAID-1 (mirrored) volume with two concate- nated plexes. The largest contiguous space available on each drive is used to create the subdisks for the plexes. The first plex is built from the odd-numbered drives in the list, and the second plex is built from the even-numbered drives. If the drives are of different sizes, the plexes will be of different sizes. If the --ss option is provided, mmiirrrroorr builds striped plexes with a stripe size of 279 kB. The size of the subdisks in each plex is the size of the smallest contiguous storage available on any of the drives which form the plex. Again, the plexes may differ in size. Normally, the mmiirrrroorr command creates an arbitrary name for the volume and its components. The name is composed of the text ``vinum'' and a small integer, for example ``vinum3''. You can override this with the --nn _n_a_m_e option, which assigns the name specified to the volume. The plexes and subdisks are named after the volume in the default manner. There is no choice of name for the drives. If the drives have already been initialized as vviinnuumm drives, the name remains. Oth- erwise the drives are given names starting with the text ``vinumdrive'' and a small integer, for example ``vinumdrive7''. As with the ccrreeaattee command, the --ff option can be used to specify that a previous name should be overwritten. The --vv is used to specify verbose output. See the section _S_I_M_P_L_I_F_I_E_D _C_O_N_F_I_G_U_R_A_T_I_O_N below for some examples of this command. mmvv --ff _d_r_i_v_e _o_b_j_e_c_t _._._. mmoovvee --ff _d_r_i_v_e _o_b_j_e_c_t _._._. Move all the subdisks from the specified objects onto the new drive. The objects may be subdisks, drives or plexes. When drives or plexes are specified, all subdisks associated with the object are moved. The --ff option is required for this function, since it currently does not preserve the data in the subdisk. This functionality will be added at a later date. In this form, however, it is suited to recovering a failed disk drive. pprriinnttccoonnffiigg [_f_i_l_e] Write a copy of the current configuration to _f_i_l_e in a format that can be used to recreate the vviinnuumm configuration. Unlike the configuration saved on disk, it includes definitions of the drives. If you omit _f_i_l_e, vviinnuumm writes the list to stdout. qquuiitt Exit the vviinnuumm utility when running in interactive mode. Nor- mally this would be done by entering the EOF character. rreeaadd _d_i_s_k _._._. The rreeaadd command scans the specified disks for vviinnuumm partitions containing previously created configuration information. It reads the configuration in order from the most recently updated to least recently updated configuration. The vviinnuumm utility main- tains an up-to-date copy of all configuration information on each disk partition. You must specify all of the slices in a configu- ration as the parameter to this command. The rreeaadd command is intended to selectively load a vviinnuumm configu- ration on a system which has other vviinnuumm partitions. If you want to start all partitions on the system, it is easier to use the ssttaarrtt command. If vviinnuumm encounters any errors during this command, it will turn off automatic configuration update to avoid corrupting the copies on disk. This will also happen if the configuration on disk indicates a configuration error (for example, subdisks which do not have a valid space specification). You can turn the updates on again with the sseettddaaeemmoonn and ssaavveeccoonnffiigg commands. Reset bit 2 (numerical value 4) of the daemon options mask to re-enable con- figuration saves. rreebbuuiillddppaarriittyy _p_l_e_x [--ff] [--vv] [--VV] Rebuild the parity blocks on the specified RAID-4 or RAID-5 plex. This operation maintains a pointer in the plex, so it can be stopped and later restarted from the same position if desired. In addition, this pointer is used by the cchheecckkppaarriittyy command, so rebuilding the parity blocks need only start at the location where the first parity problem has been detected. If the --ff flag is specified, rreebbuuiillddppaarriittyy starts rebuilding at the beginning of the plex. If the --vv flag is specified, rreebbuuiillddppaarriittyy first checks the existing parity blocks prints information about those found to be incorrect before rebuilding. If the --VV flag is specified, rreebbuuiillddppaarriittyy prints a running progress report. rreennaammee [--rr] [_d_r_i_v_e | _s_u_b_d_i_s_k | _p_l_e_x | _v_o_l_u_m_e] _n_e_w_n_a_m_e Change the name of the specified object. If the --rr option is specified, subordinate objects will be named by the default rules: plex names will be formed by appending .p_n_u_m_b_e_r to the volume name, and subdisk names will be formed by appending .s_n_u_m_b_e_r to the plex name. rreesseettccoonnffiigg The rreesseettccoonnffiigg command completely obliterates the vviinnuumm configu- ration on a system. Use this command only when you want to com- pletely delete the configuration. vviinnuumm will ask for confirma- tion; you must type in the words NO FUTURE exactly as shown: # vviinnuumm rreesseettccoonnffiigg 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 -> NNOO FFUUTTUURREE 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. Normally you remove objects with the rrmm command. rreesseettssttaattss [--rr] [_v_o_l_u_m_e | _p_l_e_x | _s_u_b_d_i_s_k] vviinnuumm maintains a number of statistical counters for each object. See the header file <_s_y_s_/_d_e_v_/_v_i_n_u_m_v_a_r_._h> for more information. Use the rreesseettssttaattss command to reset these counters. In conjunc- tion with the --rr option, vviinnuumm also resets the counters of subor- dinate objects. rrmm [--ff] [--rr] _v_o_l_u_m_e | _p_l_e_x | _s_u_b_d_i_s_k rrmm removes an object from the vviinnuumm configuration. Once an object has been removed, there is no way to recover it. Normally vviinnuumm performs a large amount of consistency checking before removing an object. The --ff option tells vviinnuumm 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, vviinnuumm refuses to remove a volume or plex if it has sub- ordinate plexes or subdisks respectively. You can tell vviinnuumm to remove the object anyway by using the --ff option, or you can cause vviinnuumm to remove the subordinate objects as well by using the --rr (recursive) option. If you remove a volume with the --rr option, it will remove both the plexes and the subdisks which belong to the plexes. ssaavveeccoonnffiigg Save the current configuration to disk. Normally this is not necessary, since vviinnuumm automatically saves any change in configu- ration. If an error occurs on startup, updates will be disabled. When you reenable them with the sseettddaaeemmoonn command, vviinnuumm does not automatically save the configuration to disk. Use this command to save the configuration. sseettddaaeemmoonn [_v_a_l_u_e] sseettddaaeemmoonn sets a variable bitmask for the vviinnuumm daemon. This command is temporary and will be replaced. Currently, the bit mask may contain the values 1 (log every action to syslog) and 4 (don't update configuration). The option bit with the value 4 can be useful for error recovery. If an error occurs on startup, updates will be disabled by setting the bit with the value 4. To reenable the configuration updates, enter setdaemon 0 sseettssttaattee _s_t_a_t_e [_v_o_l_u_m_e | _p_l_e_x | _s_u_b_d_i_s_k | _d_r_i_v_e] sseettssttaattee sets the state of the specified objects to the specified state. This bypasses the usual consistency mechanism of vviinnuumm and should be used only for recovery purposes. It is possible to crash the system by incorrect use of this command. ssttaarrtt [--ii _i_n_t_e_r_v_a_l] [--SS _s_i_z_e] [--ww] [_p_l_e_x | _s_u_b_d_i_s_k] ssttaarrtt starts (brings into to the _u_p state) one or more vviinnuumm objects. If no object names are specified, vviinnuumm scans the disks known to the system for vviinnuumm drives and then reads in the configuration as described under the rreeaadd commands. The vviinnuumm drive contains a header with all information about the data stored on the drive, including the names of the other drives which are required in order to represent plexes and volumes. If vviinnuumm encounters any errors during this command, it will turn off automatic configuration update to avoid corrupting the copies on disk. This will also happen if the configuration on disk indicates a configuration error (for example, subdisks which do not have a valid space specification). You can turn the updates on again with the sseettddaaeemmoonn and ssaavveeccoonnffiigg command. Reset the bit with value 4 of the daemon options mask to re-enable configu- ration saves. If object names are specified, vviinnuumm starts them. Normally this operation is only of use with subdisks. The action depends on the current state of the object: ++oo If the object is already in the _u_p state, vviinnuumm does nothing. ++oo If the object is a subdisk in the _d_o_w_n or _r_e_b_o_r_n states, vviinnuumm changes it to the _u_p state. ++oo If the object is a subdisk in the _e_m_p_t_y state, the change depends on the subdisk. If it is part of a plex which is part of a volume which contains other plexes, vviinnuumm places the subdisk in the _r_e_v_i_v_i_n_g state and attempts to copy the data from the volume. When the operation completes, the sub- disk is set into the _u_p state. If it is part of a plex which is part of a volume which contains no other plexes, or if it is not part of a plex, vviinnuumm brings it into the _u_p state immediately. ++oo If the object is a subdisk in the _r_e_v_i_v_i_n_g state, vviinnuumm con- tinues the revive operation offline. When the operation com- pletes, the subdisk is set into the _u_p state. When a subdisk comes into the _u_p state, vviinnuumm automatically checks the state of any plex and volume to which it may belong and changes their state where appropriate. If the object is a plex, ssttaarrtt checks the state of the subordi- nate subdisks (and plexes in the case of a volume) and starts any subdisks which can be started. To start a plex in a multi-plex volume, the data must be copied from another plex in the volume. Since this frequently takes a long time, it is normally done in the background. If you want to wait for this operation to complete (for example, if you are per- forming this operation in a script), use the --ww option. Copying data doesn't just take a long time, it can also place a significant load on the system. You can specify the transfer size in bytes or sectors with the --SS option, and an interval (in milliseconds) to wait between copying each block with the --ii option. Both of these options lessen the load on the system. ssttoopp [--ff] [_v_o_l_u_m_e | _p_l_e_x | _s_u_b_d_i_s_k] If no parameters are specified, ssttoopp removes the vviinnuumm LKM and stops vinum(4). This can only be done if no objects are active. In particular, the --ff option does not override this requirement. Normally, the ssttoopp command writes the current configuration back to the drives before terminating. This will not be possible if configuration updates are disabled, so vviinnuumm will not stop if configuration updates are disabled. You can override this by specifying the --ff option. The ssttoopp command for vviinnuumm can only if work vviinnuumm has been loaded as a LKM, since it is not possible to unload a statically config- ured driver. vviinnuumm ssttoopp will fail if vviinnuumm is statically config- ured. If object names are specified, ssttoopp disables access to the objects. If the objects have subordinate objects, the subordi- nate objects must either already be inactive (stopped or in error), or the --rr and --ff options must be specified. This command does not remove the objects from the configuration. They can be accessed again after a ssttaarrtt command. By default, vviinnuumm does not stop active objects. For example, you cannot stop a plex which is attached to an active volume, and you cannot stop a volume which is open. The --ff option tells vviinnuumm 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. ssttrriippee [--ff] [--nn _n_a_m_e] [--vv] _d_r_i_v_e_s The ssttrriippee command provides a simplified alternative to the ccrreeaattee command for creating volumes with a single striped plex. The size of the subdisks is the size of the largest contiguous space available on all the specified drives. The stripe size is fixed at 279 kB. Normally, the ssttrriippee command creates an arbitrary name for the volume and its components. The name is composed of the text ``vinum'' and a small integer, for example ``vinum3''. You can override this with the --nn _n_a_m_e option, which assigns the name specified to the volume. The plexes and subdisks are named after the volume in the default manner. There is no choice of name for the drives. If the drives have already been initialized as vviinnuumm drives, the name remains. Oth- erwise the drives are given names starting with the text ``vinumdrive'' and a small integer, for example ``vinumdrive7''. As with the ccrreeaattee command, the --ff option can be used to specify that a previous name should be overwritten. The --vv is used to specify verbose output. See the section _S_I_M_P_L_I_F_I_E_D _C_O_N_F_I_G_U_R_A_T_I_O_N below for some examples of this command. SSIIMMPPLLIIFFIIEEDD CCOONNFFIIGGUURRAATTIIOONN This section describes a simplified interface to vviinnuumm configuration using the ccoonnccaatt, mmiirrrroorr and ssttrriippee commands. These commands create con- venient configurations for some more normal situations, but they are not as flexible as the ccrreeaattee command. See above for the description of the commands. Here are some examples, all performed with the same collection of disks. Note that the first drive, _/_d_e_v_/_d_a_1_h, is smaller than the others. This has an effect on the sizes chosen for each kind of subdisk. The following examples all use the --vv option to show the commands passed to the system, and also to list the structure of the volume. Without the --vv option, these commands produce no output. VVoolluummee wwiitthh aa ssiinnggllee ccoonnccaatteennaatteedd pplleexx Use a volume with a single concatenated plex for the largest possible storage without resilience to drive failures: vinum -> concat -v /dev/da1h /dev/da2h /dev/da3h /dev/da4h volume vinum0 plex name vinum0.p0 org concat drive vinumdrive0 device /dev/da1h sd name vinum0.p0.s0 drive vinumdrive0 size 0 drive vinumdrive1 device /dev/da2h sd name vinum0.p0.s1 drive vinumdrive1 size 0 drive vinumdrive2 device /dev/da3h sd name vinum0.p0.s2 drive vinumdrive2 size 0 drive vinumdrive3 device /dev/da4h sd name vinum0.p0.s3 drive vinumdrive3 size 0 V vinum0 State: up Plexes: 1 Size: 2134 MB P vinum0.p0 C State: up Subdisks: 4 Size: 2134 MB S vinum0.p0.s0 State: up D: vinumdrive0 Size: 414 MB S vinum0.p0.s1 State: up D: vinumdrive1 Size: 573 MB S vinum0.p0.s2 State: up D: vinumdrive2 Size: 573 MB S vinum0.p0.s3 State: up D: vinumdrive3 Size: 573 MB In this case, the complete space on all four disks was used, giving a volume 2134 MB in size. VVoolluummee wwiitthh aa ssiinnggllee ssttrriippeedd pplleexx A volume with a single striped plex may give better performance than a concatenated plex, but restrictions on striped plexes can mean that the volume is smaller. It will also not be resilient to a drive failure: vinum -> stripe -v /dev/da1h /dev/da2h /dev/da3h /dev/da4h drive vinumdrive0 device /dev/da1h drive vinumdrive1 device /dev/da2h drive vinumdrive2 device /dev/da3h drive vinumdrive3 device /dev/da4h volume vinum0 plex name vinum0.p0 org striped 279k sd name vinum0.p0.s0 drive vinumdrive0 size 849825b sd name vinum0.p0.s1 drive vinumdrive1 size 849825b sd name vinum0.p0.s2 drive vinumdrive2 size 849825b sd name vinum0.p0.s3 drive vinumdrive3 size 849825b V vinum0 State: up Plexes: 1 Size: 1659 MB P vinum0.p0 S State: up Subdisks: 4 Size: 1659 MB S vinum0.p0.s0 State: up D: vinumdrive0 Size: 414 MB S vinum0.p0.s1 State: up D: vinumdrive1 Size: 414 MB S vinum0.p0.s2 State: up D: vinumdrive2 Size: 414 MB S vinum0.p0.s3 State: up D: vinumdrive3 Size: 414 MB In this case, the size of the subdisks has been limited to the smallest available disk, so the resulting volume is only 1659 MB in size. MMiirrrroorreedd vvoolluummee wwiitthh ttwwoo ccoonnccaatteennaatteedd pplleexxeess For more reliability, use a mirrored, concatenated volume: vinum -> mirror -v -n mirror /dev/da1h /dev/da2h /dev/da3h /dev/da4h drive vinumdrive0 device /dev/da1h drive vinumdrive1 device /dev/da2h drive vinumdrive2 device /dev/da3h drive vinumdrive3 device /dev/da4h volume mirror setupstate plex name mirror.p0 org concat sd name mirror.p0.s0 drive vinumdrive0 size 0b sd name mirror.p0.s1 drive vinumdrive2 size 0b plex name mirror.p1 org concat sd name mirror.p1.s0 drive vinumdrive1 size 0b sd name mirror.p1.s1 drive vinumdrive3 size 0b V mirror State: up Plexes: 2 Size: 1146 MB P mirror.p0 C State: up Subdisks: 2 Size: 988 MB P mirror.p1 C State: up Subdisks: 2 Size: 1146 MB S vinum0.p0.s0 State: up D: vinumdrive0 Size: 414 MB S vinum0.p0.s2 State: up D: vinumdrive2 Size: 414 MB S vinum0.p0.s1 State: up D: vinumdrive1 Size: 414 MB S vinum0.p0.s3 State: up D: vinumdrive3 Size: 414 MB This example specifies the name of the volume, _m_i_r_r_o_r. Since one drive is smaller than the others, the two plexes are of different size, and the last 158 MB of the volume is non-resilient. To ensure complete reliabil- ity in such a situation, use the ccrreeaattee command to create a volume with 988 MB. MMiirrrroorreedd vvoolluummee wwiitthh ttwwoo ssttrriippeedd pplleexxeess Alternatively, use the --ss option to create a mirrored volume with two striped plexes: vinum -> mirror -v -n raid10 -s /dev/da1h /dev/da2h /dev/da3h /dev/da4h drive vinumdrive0 device /dev/da1h drive vinumdrive1 device /dev/da2h drive vinumdrive2 device /dev/da3h drive vinumdrive3 device /dev/da4h volume raid10 setupstate plex name raid10.p0 org striped 279k sd name raid10.p0.s0 drive vinumdrive0 size 849825b sd name raid10.p0.s1 drive vinumdrive2 size 849825b plex name raid10.p1 org striped 279k sd name raid10.p1.s0 drive vinumdrive1 size 1173665b sd name raid10.p1.s1 drive vinumdrive3 size 1173665b V raid10 State: up Plexes: 2 Size: 1146 MB P raid10.p0 S State: up Subdisks: 2 Size: 829 MB P raid10.p1 S State: up Subdisks: 2 Size: 1146 MB S raid10.p0.s0 State: up PO: 0 B Size: 414 MB S raid10.p0.s1 State: up PO: 279 kB Size: 414 MB S raid10.p1.s0 State: up PO: 0 B Size: 573 MB S raid10.p1.s1 State: up PO: 279 kB Size: 573 MB In this case, the usable part of the volume is even smaller, since the first plex has shrunken to match the smallest drive. CCOONNFFIIGGUURRAATTIIOONN FFIILLEE The vviinnuumm utility requires that all parameters to the ccrreeaattee 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. SSccaallee ffaaccttoorrss Some configuration file parameters specify a size (lengths, stripe sizes). These values can be specified as bytes, or one of the following scale factors may be appended: s specifies that the value is a number of sectors of 512 bytes. k specifies that the value is a number of kilobytes (1024 bytes). m specifies that the value is a number of megabytes (1048576 bytes). g specifies that the value is a number of gigabytes (1073741824 bytes). b is used for compatibility with VERITAS. It stands for blocks of 512 bytes. This abbreviation is confusing, since the word ``block'' is used in different meanings, and its use is depre- cated. Use the keyword 's' instead. For example, the value 16777216 bytes can also be written as _1_6_m, _1_6_3_8_4_k or _3_2_7_6_8_s. The configuration file can contain the following entries: ddrriivvee _n_a_m_e _d_e_v_i_c_e_n_a_m_e [_o_p_t_i_o_n_s] Define a drive. The options are: ddeevviiccee _d_e_v_i_c_e_n_a_m_e Specify the device on which the drive resides. _d_e_v_i_c_e_n_a_m_e must be the name of a disk parti- tion, for example _/_d_e_v_/_d_a_1_e or _/_d_e_v_/_a_d_3_s_2_h, and it must be of type _v_i_n_u_m. Do not use the ``c'' partition, which is reserved for the complete disk. hhoottssppaarree Define the drive to be a ``hot spare'' drive, which is maintained to automatically replace a failed drive. The vviinnuumm utility does not allow this drive to be used for any other purpose. In particular, it is not possible to create subdisks on it. This functionality has not been completely implemented. vvoolluummee _n_a_m_e [_o_p_t_i_o_n_s] Define a volume with name _n_a_m_e. Options are: pplleexx _p_l_e_x_n_a_m_e Add the specified plex to the volume. If _p_l_e_x_n_a_m_e is specified as **, vviinnuumm will look for the definition of the plex as the next possible entry in the configuration file after the defi- nition of the volume. sseettuuppssttaattee When creating a multi-plex volume, assume that the contents of all the plexes are consistent. This is normally not the case, so by default vviinnuumm sets all plexes except the first one to the _f_a_u_l_t_y state. Use the ssttaarrtt command to first bring them to a consistent state. In the case of striped and concatenated plexes, how- ever, it does not normally cause problems to leave them inconsistent: when using a volume for a file system or a swap partition, the pre- vious contents of the disks are not of inter- est, so they may be ignored. If you want to take this risk, use the sseettuuppssttaattee keyword. It will only apply to the plexes defined immedi- ately after the volume in the configuration file. If you add plexes to a volume at a later time, you must integrate them manually with the ssttaarrtt command. Note that you _m_u_s_t use the iinniitt command with RAID-5 plexes: otherwise extreme data corrup- tion will result if one subdisk fails. pplleexx [_o_p_t_i_o_n_s] Define a plex. Unlike a volume, you do not need to specify a name for a plex. The options may be: nnaammee _p_l_e_x_n_a_m_e Specify the name of the plex. Note that you must use the keyword nnaammee before the name of a plex or subdisk. oorrgg _o_r_g_a_n_i_z_a_t_i_o_n [_s_t_r_i_p_e_s_i_z_e] Specify the organization of the plex. _o_r_g_a_n_i_z_a_t_i_o_n can be one of ccoonnccaatt, ssttrriippeedd or rraaiidd55. For ssttrriippeedd and rraaiidd55 plexes, the parameter _s_t_r_i_p_e_s_i_z_e must be specified, while for ccoonnccaatt it must be omitted. For type ssttrriippeedd, it specifies the width of each stripe. For type rraaiidd55, 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 activ- ity due to mapping of individual requests over multiple disks. The performance improvement due to the increased number of concurrent transfers caused by this mapping will not make up for the performance drop due to the increase in latency. A good guideline for stripe size is between 256 kB and 512 kB. Avoid powers of 2, however: they tend to cause all superblocks to be placed on the first subdisk. A good size is 496 kB, which is a multiple of the block size but not a power of 2. 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. vvoolluummee _v_o_l_n_a_m_e Add the plex to the specified volume. If no vvoolluummee keyword is specified, the plex will be added to the last volume mentioned in the con- figuration file. ssdd _s_d_n_a_m_e _o_f_f_s_e_t Add the specified subdisk to the plex at offset _o_f_f_s_e_t. ddeettaacchheedd Specify that the plex should not be attached to a volume. Normally vviinnuumm attaches the plex to the last-mentioned volume. pprreeffeerrrreedd Specify that this plex is the preferred plex for reads from its volume. Normally vviinnuumm per- forms each read from a different plex in _r_o_u_n_d_-_r_o_b_i_n fashion. This keyword states that all reads should be from this plex. it replaces the obsolete _p_r_e_f_e_r keyword for vol- umes, which was never correctly implemented. ssuubbddiisskk [_o_p_t_i_o_n_s] Define a subdisk. Options may be: nnaammee _n_a_m_e Specify the name of a subdisk. It is not nec- essary to specify a name for a subdisk--see _O_B_J_E_C_T _N_A_M_I_N_G above. Note that you must spec- ify the keyword nnaammee if you wish to name a sub- disk. ddeettaacchheedd Specify that the subdisk should not be attached to a plex. Normally vviinnuumm attaches the plex to the last-mentioned subdisk. pplleexxooffffsseett _o_f_f_s_e_t Specify the starting offset of the subdisk in the plex. If not specified, vviinnuumm allocates the space immediately after the previous sub- disk, if any, or otherwise at the beginning of the plex. ddrriivveeooffffsseett _o_f_f_s_e_t Specify the starting offset of the subdisk in the drive. If not specified, vviinnuumm allocates the first contiguous _l_e_n_g_t_h bytes of free space on the drive. lleennggtthh _l_e_n_g_t_h Specify the length of the subdisk. This key- word must be specified. There is no default, but the value 0 may be specified to mean ``use the largest available contiguous free area on the drive''. If the drive is empty, this means that the entire drive will be used for the sub- disk. lleennggtthh may be shortened to lleenn. pplleexx _p_l_e_x Specify the plex to which the subdisk belongs. By default, the subdisk belongs to the last plex specified. ddrriivvee _d_r_i_v_e Specify the drive on which the subdisk resides. By default, the subdisk resides on the last drive specified. rreettrryyeerrrroorrss Specify that the subdisk should not be taken down if an unrecoverable error occurs. Nor- mally vviinnuumm responds to an unrecoverable error by making the entire subdisk inaccessible. EEXXAAMMPPLLEE CCOONNFFIIGGUURRAATTIIOONN FFIILLEE # 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 496k sd length 640m drive drive2 sd length 640m drive drive4 volume stripe plex org striped 496k sd length 512g drive drive2 sd length 512g drive drive4 # Two plexes volume concat plex org concat sd length 100g drive drive2 sd length 50g drive drive4 plex org concat sd length 150g drive drive4 # A volume with one striped plex and one concatenated plex volume strcon plex org striped 496k sd length 100g drive drive2 sd length 100g drive drive4 plex org concat sd length 150g drive drive2 sd length 50g 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 491k sd length 1000g drive drive2 sd length 1000g drive drive4 plex org raid5 480k sd length 500g drive drive1 sd length 500g drive drive2 sd length 500g drive drive3 sd length 500g drive drive4 sd length 500g drive drive5 DDRRIIVVEE LLAAYYOOUUTT CCOONNSSIIDDEERRAATTIIOONNSS vviinnuumm drives are currently BSD disk partitions. They must be of type _v_i_n_u_m in order to avoid overwriting data used for other purposes. Use ddiisskkllaabbeell --ee to edit a partition type definition. The following display shows a typical partition layout as shown by disklabel(8): 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 vinum 0 0 0 # (Cyl. 1626*- 2955*) In this example, partition ``g'' may be used as a vviinnuumm partition. Par- titions ``a'', ``e'' and ``f'' may be used as _U_F_S file systems or _c_c_d partitions. Partition ``b'' is a swap partition, and partition ``c'' represents the whole disk and should not be used for any other purpose. The vviinnuumm utility uses the first 265 sectors on each partition for con- figuration information, so the maximum size of a subdisk is 265 sectors smaller than the drive. LLOOGG FFIILLEE The vviinnuumm utility maintains a log file, by default _/_v_a_r_/_l_o_g_/_v_i_n_u_m___h_i_s_t_o_r_y, in which it keeps track of the commands issued to vviinnuumm. You can override the name of this file by setting the environment variable VINUM_HISTORY to the name of the file. Each message in the log file is preceded by a date. The default format is "%e %b %Y %H:%M:%S". See strftime(3) for further details of the for- mat string. It can be overridden by the environment variable VINUM_DATEFORMAT. HHOOWW TTOO SSEETT UUPP VVIINNUUMM This section gives practical advice about how to implement a vviinnuumm sys- tem. WWhheerree ttoo ppuutt tthhee ddaattaa The first choice you need to make is where to put the data. You need dedicated disk partitions for vviinnuumm. They should be partitions, not devices, and they should not be partition ``c''. For example, good names are _/_d_e_v_/_d_a_0_e or _/_d_e_v_/_a_d_3_s_4_a. Bad names are _/_d_e_v_/_d_a_0 and _/_d_e_v_/_d_a_0_s_1, both of which represent a device, not a partition, and _/_d_e_v_/_a_d_1_c, which represents a complete disk and should be of type _u_n_u_s_e_d. See the example under _D_R_I_V_E _L_A_Y_O_U_T _C_O_N_S_I_D_E_R_A_T_I_O_N_S above. Do not put more than one vviinnuumm partition on a disk drive. If you want multiple volumes, create multiple subdisks, not multiple drives. DDeessiiggnniinngg vvoolluummeess The way you set up vviinnuumm volumes depends on your intentions. There are a number of possibilities: 1. You may want to join up a number of small disks to make a reasonable sized file system. For example, if you had five small drives and wanted to use all the space for a single volume, you might write a configuration file like: drive d1 device /dev/da2e drive d2 device /dev/da3e drive d3 device /dev/da4e drive d4 device /dev/da5e drive d5 device /dev/da6e volume bigger plex org concat sd length 0 drive d1 sd length 0 drive d2 sd length 0 drive d3 sd length 0 drive d4 sd length 0 drive d5 In this case, you specify the length of the subdisks as 0, which means ``use the largest area of free space that you can find on the drive''. If the subdisk is the only subdisk on the drive, it will use all available space. 2. You want to set up vviinnuumm to obtain additional resilience against disk failures. You have the choice of RAID-1, also called ``mirroring'', or RAID-5, also called ``parity''. To set up mirroring, create multiple plexes in a volume. For exam- ple, to create a mirrored volume of 2 GB, you might create the fol- lowing configuration file: drive d1 device /dev/da2e drive d2 device /dev/da3e volume mirror plex org concat sd length 2g drive d1 plex org concat sd length 2g drive d2 When creating mirrored drives, it is important to ensure that the data from each plex is on a different physical disk so that vviinnuumm can access the complete address space of the volume even if a drive fails. Note that each plex requires as much data as the complete volume: in this example, the volume has a size of 2 GB, but each plex (and each subdisk) requires 2 GB, so the total disk storage requirement is 4 GB. To set up RAID-5, create a single plex of type rraaiidd55. For example, to create an equivalent resilient volume of 2 GB, you might use the following configuration file: drive d1 device /dev/da2e drive d2 device /dev/da3e drive d3 device /dev/da4e drive d4 device /dev/da5e drive d5 device /dev/da6e volume raid plex org raid5 432k sd length 512m drive d1 sd length 512m drive d2 sd length 512m drive d3 sd length 512m drive d4 sd length 512m drive d5 RAID-5 plexes require at least three subdisks, one of which is used for storing parity information and is lost for data storage. The more disks you use, the greater the proportion of the disk storage can be used for data storage. In this example, the total storage usage is 2.5 GB, compared to 4 GB for a mirrored configuration. If you were to use the minimum of only three disks, you would require 3 GB to store the information, for example: drive d1 device /dev/da2e drive d2 device /dev/da3e drive d3 device /dev/da4e volume raid plex org raid5 432k sd length 1g drive d1 sd length 1g drive d2 sd length 1g drive d3 As with creating mirrored drives, it is important to ensure that the data from each subdisk is on a different physical disk so that vviinnuumm can access the complete address space of the volume even if a drive fails. 3. You want to set up vviinnuumm to allow more concurrent access to a file system. In many cases, access to a file system is limited by the speed of the disk. By spreading the volume across multiple disks, you can increase the throughput in multi-access environments. This technique shows little or no performance improvement in single- access environments. The vviinnuumm utility uses a technique called ``striping'', or sometimes RAID-0, to increase this concurrency of access. The name RAID-0 is misleading: striping does not provide any redundancy or additional reliability. In fact, it decreases the reliability, since the failure of a single disk will render the vol- ume useless, and the more disks you have, the more likely it is that one of them will fail. To implement striping, use a ssttrriippeedd plex: drive d1 device /dev/da2e drive d2 device /dev/da3e drive d3 device /dev/da4e drive d4 device /dev/da5e volume raid plex org striped 432k sd length 512m drive d1 sd length 512m drive d2 sd length 512m drive d3 sd length 512m drive d4 A striped plex must have at least two subdisks. 4. You may want to have the best of both worlds and have both resilience and performance. This is sometimes called RAID-10 (a combination of RAID-1 and RAID-0), though again this name is mis- leading. With vviinnuumm you can do this with the following configura- tion file: drive d1 device /dev/da2e drive d2 device /dev/da3e drive d3 device /dev/da4e drive d4 device /dev/da5e volume raid setupstate plex org striped 432k sd length 512m drive d1 sd length 512m drive d2 sd length 512m drive d3 sd length 512m drive d4 plex org striped 432k sd length 512m drive d4 sd length 512m drive d3 sd length 512m drive d2 sd length 512m drive d1 Here the plexes are striped, increasing performance, and there are two of them, increasing reliability. Note that this example shows the subdisks of the second plex in reverse order from the first plex. This is for performance reasons and will be discussed below. In addition, the volume specification includes the keyword sseettuuppssttaattee, which ensures that all plexes are _u_p after creation. CCrreeaattiinngg tthhee vvoolluummeess Once you have created your configuration files, start vviinnuumm and create the volumes. In this example, the configuration is in the file _c_o_n_f_i_g_f_i_l_e: # vinum create -v configfile 1: drive d1 device /dev/da2e 2: drive d2 device /dev/da3e 3: volume mirror 4: plex org concat 5: sd length 2g drive d1 6: plex org concat 7: sd length 2g drive d2 Configuration summary 2 drives: Drive d1: Device /dev/da2e Created on vinum.lemis.com at Tue Mar 23 12:30:31 1999 Config last updated Tue Mar 23 14:30:32 1999 Size: 60105216000 bytes (57320 MB) Used: 2147619328 bytes (2048 MB) Available: 57957596672 bytes (55272 MB) State: up Last error: none Drive d2: Device /dev/da3e Created on vinum.lemis.com at Tue Mar 23 12:30:32 1999 Config last updated Tue Mar 23 14:30:33 1999 Size: 60105216000 bytes (57320 MB) Used: 2147619328 bytes (2048 MB) Available: 57957596672 bytes (55272 MB) State: up Last error: none 1 volumes: Volume mirror: Size: 2147483648 bytes (2048 MB) State: up Flags: 2 plexes Read policy: round robin 2 plexes: Plex mirror.p0: Size: 2147483648 bytes (2048 MB) Subdisks: 1 State: up Organization: concat Part of volume mirror Plex mirror.p1: Size: 2147483648 bytes (2048 MB) Subdisks: 1 State: up Organization: concat Part of volume mirror 2 subdisks: Subdisk mirror.p0.s0: Size: 2147483648 bytes (2048 MB) State: up Plex mirror.p0 at offset 0 Subdisk mirror.p1.s0: Size: 2147483648 bytes (2048 MB) State: up Plex mirror.p1 at offset 0 The --vv option tells vviinnuumm to list the file as it configures. Subse- quently it lists the current configuration in the same format as the lliisstt --vv command. CCrreeaattiinngg mmoorree vvoolluummeess Once you have created the vviinnuumm volumes, vviinnuumm keeps track of them in its internal configuration files. You do not need to create them again. In particular, if you run the ccrreeaattee command again, you will create addi- tional objects: # vinum create sampleconfig Configuration summary Drives: 2 (4 configured) Volumes: 1 (4 configured) Plexes: 4 (8 configured) Subdisks: 4 (16 configured) D d1 State: up Device /dev/da2e Avail: 53224/57320 MB (92%) D d2 State: up Device /dev/da3e Avail: 53224/57320 MB (92%) V mirror State: up Plexes: 4 Size: 2048 MB P mirror.p0 C State: up Subdisks: 1 Size: 2048 MB P mirror.p1 C State: up Subdisks: 1 Size: 2048 MB P mirror.p2 C State: up Subdisks: 1 Size: 2048 MB P mirror.p3 C State: up Subdisks: 1 Size: 2048 MB S mirror.p0.s0 State: up PO: 0 B Size: 2048 MB S mirror.p1.s0 State: up PO: 0 B Size: 2048 MB S mirror.p2.s0 State: up PO: 0 B Size: 2048 MB S mirror.p3.s0 State: up PO: 0 B Size: 2048 MB As this example (this time with the --ff option) shows, re-running the ccrreeaattee has created four new plexes, each with a new subdisk. If you want to add other volumes, create new configuration files for them. They do not need to reference the drives that vviinnuumm already knows about. For example, to create a volume _r_a_i_d on the four drives _/_d_e_v_/_d_a_1_e, _/_d_e_v_/_d_a_2_e, _/_d_e_v_/_d_a_3_e and _/_d_e_v_/_d_a_4_e, you only need to mention the other two: drive d3 device /dev/da1e drive d4 device /dev/da4e volume raid plex org raid5 432k sd size 2g drive d1 sd size 2g drive d2 sd size 2g drive d3 sd size 2g drive d4 With this configuration file, we get: # vinum create newconfig Configuration summary Drives: 4 (4 configured) Volumes: 2 (4 configured) Plexes: 5 (8 configured) Subdisks: 8 (16 configured) D d1 State: up Device /dev/da2e Avail: 51176/57320 MB (89%) D d2 State: up Device /dev/da3e Avail: 53220/57320 MB (89%) D d3 State: up Device /dev/da1e Avail: 53224/57320 MB (92%) D d4 State: up Device /dev/da4e Avail: 53224/57320 MB (92%) V mirror State: down Plexes: 4 Size: 2048 MB V raid State: down Plexes: 1 Size: 6144 MB P mirror.p0 C State: init Subdisks: 1 Size: 2048 MB P mirror.p1 C State: init Subdisks: 1 Size: 2048 MB P mirror.p2 C State: init Subdisks: 1 Size: 2048 MB P mirror.p3 C State: init Subdisks: 1 Size: 2048 MB P raid.p0 R5 State: init Subdisks: 4 Size: 6144 MB S mirror.p0.s0 State: up PO: 0 B Size: 2048 MB S mirror.p1.s0 State: up PO: 0 B Size: 2048 MB S mirror.p2.s0 State: up PO: 0 B Size: 2048 MB S mirror.p3.s0 State: up PO: 0 B Size: 2048 MB S raid.p0.s0 State: empty PO: 0 B Size: 2048 MB S raid.p0.s1 State: empty PO: 432 kB Size: 2048 MB S raid.p0.s2 State: empty PO: 864 kB Size: 2048 MB S raid.p0.s3 State: empty PO: 1296 kB Size: 2048 MB Note the size of the RAID-5 plex: it is only 6 GB, although together its components use 8 GB of disk space. This is because the equivalent of one subdisk is used for storing parity data. RReessttaarrttiinngg VViinnuumm On rebooting the system, start vviinnuumm with the ssttaarrtt command: # vinum start This will start all the vviinnuumm drives in the system. If for some reason you wish to start only some of them, use the rreeaadd command. PPeerrffoorrmmaannccee ccoonnssiiddeerraattiioonnss A number of misconceptions exist about how to set up a RAID array for best performance. In particular, most systems use far too small a stripe size. The following discussion applies to all RAID systems, not just to vviinnuumm. The FreeBSD block I/O system issues requests of between .5kB and 128 kB; a typical mix is somewhere round 8 kB. You can't stop any striping sys- tem from breaking a request into two physical requests, and if you make the stripe small enough, it can be broken into several. This will result in a significant drop in performance: the decrease in transfer time per disk is offset by the order of magnitude greater increase in latency. With modern disk sizes and the FreeBSD I/O system, you can expect to have a reasonably small number of fragmented requests with a stripe size between 256 kB and 512 kB; with correct RAID implementations there is no obvious reason not to increase the size to 2 or 4 MB on a large disk. When choosing a stripe size, consider that most current UFS file systems have cylinder groups 32 MB in size. If you have a stripe size and number of disks both of which are a power of two, it is probable that all superblocks and inodes will be placed on the same subdisk, which will impact performance significantly. Choose an odd number instead, for example 479 kB. The easiest way to consider the impact of any transfer in a multi-access system is to look at it from the point of view of the potential bottle- neck, the disk subsystem: how much total disk time does the transfer use? Since just about everything is cached, the time relationship between the request and its completion is not so important: the important parameter is the total time that the request keeps the disks active, the time when the disks are not available to perform other transfers. As a result, it doesn't really matter if the transfers are happening at the same time or different times. In practical terms, the time we're looking at is the sum of the total latency (positioning time and rotational latency, or the time it takes for the data to arrive under the disk heads) and the total transfer time. For a given transfer to disks of the same speed, the transfer time depends only on the total size of the transfer. Consider a typical news article or web page of 24 kB, which will probably be read in a single I/O. Take disks with a transfer rate of 6 MB/s and an average positioning time of 8 ms, and a file system with 4 kB blocks. Since it's 24 kB, we don't have to worry about fragments, so the file will start on a 4 kB boundary. The number of transfers required depends on where the block starts: it's (S + F - 1) / S, where S is the stripe size in file system blocks, and F is the file size in file system blocks. 1. Stripe size of 4 kB. You'll have 6 transfers. Total subsystem load: 48 ms latency, 2 ms transfer, 50 ms total. 2. Stripe size of 8 kB. On average, you'll have 3.5 transfers. Total subsystem load: 28 ms latency, 2 ms transfer, 30 ms total. 3. Stripe size of 16 kB. On average, you'll have 2.25 transfers. Total subsystem load: 18 ms latency, 2 ms transfer, 20 ms total. 4. Stripe size of 256 kB. On average, you'll have 1.08 transfers. Total subsystem load: 8.6 ms latency, 2 ms transfer, 10.6 ms total. 5. Stripe size of 4 MB. On average, you'll have 1.0009 transfers. Total subsystem load: 8.01 ms latency, 2 ms transfer, 10.01 ms total. It appears that some hardware RAID systems have problems with large stripes: they appear to always transfer a complete stripe to or from disk, so that a large stripe size will have an adverse effect on perfor- mance. The vviinnuumm utility does not suffer from this problem: it optimizes all disk transfers and does not transfer unneeded data. Note that no well-known benchmark program tests true multi-access condi- tions (more than 100 concurrent users), so it is difficult to demonstrate the validity of these statements. Given these considerations, the following factors affect the performance of a vviinnuumm volume: ++oo Striping improves performance for multiple access only, since it increases the chance of individual requests being on different drives. ++oo Concatenating UFS file systems across multiple drives can also improve performance for multiple file access, since UFS divides a file system into cylinder groups and attempts to keep files in a sin- gle cylinder group. In general, it is not as effective as striping. ++oo Mirroring can improve multi-access performance for reads, since by default vviinnuumm issues consecutive reads to consecutive plexes. ++oo Mirroring decreases performance for all writes, whether multi-access or single access, since the data must be written to both plexes. This explains the subdisk layout in the example of a mirroring con- figuration above: if the corresponding subdisk in each plex is on a different physical disk, the write commands can be issued in paral- lel, whereas if they are on the same physical disk, they will be per- formed sequentially. ++oo RAID-5 reads have essentially the same considerations as striped reads, unless the striped plex is part of a mirrored volume, in which case the performance of the mirrored volume will be better. ++oo RAID-5 writes are approximately 25% of the speed of striped writes: to perform the write, vviinnuumm must first read the data block and the corresponding parity block, perform some calculations and write back the parity block and the data block, four times as many transfers as for writing a striped plex. On the other hand, this is offset by the cost of mirroring, so writes to a volume with a single RAID-5 plex are approximately half the speed of writes to a correctly configured volume with two striped plexes. ++oo When the vviinnuumm configuration changes (for example, adding or removing objects, or the change of state of one of the objects), vviinnuumm writes up to 128 kB of updated configuration to each drive. The larger the number of drives, the longer this takes. CCrreeaattiinngg ffiillee ssyysstteemmss oonn VViinnuumm vvoolluummeess You do not need to run disklabel(8) before creating a file system on a vviinnuumm volume. Just run newfs(8). Use the --vv option to state that the device is not divided into partitions. For example, to create a file system on volume _m_i_r_r_o_r, enter the following command: # newfs -v /dev/vinum/mirror A number of other considerations apply to vviinnuumm configuration: ++oo There is no advantage in creating multiple drives on a single disk. Each drive uses 131.5 kB of data for label and configuration informa- tion, and performance will suffer when the configuration changes. Use appropriately sized subdisks instead. ++oo It is possible to increase the size of a concatenated vviinnuumm plex, but currently the size of striped and RAID-5 plexes cannot be increased. Currently the size of an existing UFS file system also cannot be increased, but it is planned to make both plexes and file systems extensible. SSTTAATTEE MMAANNAAGGEEMMEENNTT Vinum objects have the concept of _s_t_a_t_e. See vinum(4) for more details. They are only completely accessible if their state is _u_p. To change an object state to _u_p, use the ssttaarrtt command. To change an object state to _d_o_w_n, use the ssttoopp command. Normally other states are created automati- cally by the relationship between objects. For example, if you add a plex to a volume, the subdisks of the plex will be set in the _e_m_p_t_y state, indicating that, though the hardware is accessible, the data on the subdisk is invalid. As a result of this state, the plex will be set in the _f_a_u_l_t_y state. TThhee ``rreevviivviinngg'' ssttaattee In many cases, when you start a subdisk the system must copy data to the subdisk. Depending on the size of the subdisk, this can take a long time. During this time, the subdisk is set in the _r_e_v_i_v_i_n_g state. On successful completion of the copy operation, it is automatically set to the _u_p state. It is possible for the process performing the revive to be stopped and restarted. The system keeps track of how far the subdisk has been revived, and when the ssttaarrtt command is reissued, the copying contin- ues from this point. In order to maintain the consistency of a volume while one or more of its plexes is being revived, vviinnuumm writes to subdisks which have been revived up to the point of the write. It may also read from the plex if the area being read has already been revived. GGOOTTCCHHAASS The following points are not bugs, and they have good reasons for exist- ing, but they have shown to cause confusion. Each is discussed in the appropriate section above. 1. vviinnuumm drives are UNIX disk partitions and must have the partition type _v_i_n_u_m. This is different from ccd, which expects partitions of type _4_._2_B_S_D. This behaviour of ccccdd is an invitation to shoot your- self in the foot: with ccccdd you can easily overwrite a file system. The vviinnuumm utility will not permit this. For similar reasons, the vviinnuumm ssttaarrtt command will not accept a drive on partition ``c''. Partition ``c'' is used by the system to repre- sent the whole disk, and must be of type _u_n_u_s_e_d. Clearly there is a conflict here, which vviinnuumm resolves by not using the ``c'' parti- tion. 2. When you create a volume with multiple plexes, vviinnuumm does not auto- matically initialize the plexes. This means that the contents are not known, but they are certainly not consistent. As a result, by default vviinnuumm sets the state of all newly-created plexes except the first to _f_a_u_l_t_y. In order to synchronize them with the first plex, you must ssttaarrtt them, which causes vviinnuumm to copy the data from a plex which is in the _u_p state. Depending on the size of the subdisks involved, this can take a long time. 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 _u_p anyway. The vviinnuumm utility provides two ways to ensure that newly created plexes are _u_p: ++oo Create the plexes and then synchronize them with vviinnuumm ssttaarrtt. ++oo Create the volume (not the plex) with the keyword sseettuuppssttaattee, which tells vviinnuumm to ignore any possible inconsistency and set the plexes to be _u_p. 3. Some of the commands currently supported by vviinnuumm are not really needed. For reasons which I don't understand, however, I find that users frequently try the llaabbeell and rreesseettccoonnffiigg commands, though especially rreesseettccoonnffiigg 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 _r_e_b_o_r_n sub- disk, try first to get it into _s_t_o_p_p_e_d state, with the ssttoopp or ssttoopp --ff 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 --DDVINUMDEBUG option, you must also build vviinnuumm with the --DDVINUMDEBUG 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 a corresponding error message. 6. The vviinnuumm rreeaadd command has a particularly emetic syntax. Once it was the only way to start vviinnuumm, but now the preferred method is with vviinnuumm ssttaarrtt. vviinnuumm rreeaadd should be used for maintenance pur- poses only. Note that its syntax has changed, and the arguments must be disk slices, such as _/_d_e_v_/_d_a_0, not partitions such as _/_d_e_v_/_d_a_0_e. FFIILLEESS /dev/vinum directory with device nodes for vviinnuumm objects /dev/vinum/control control device for vviinnuumm /dev/vinum/plex directory containing device nodes for vviinnuumm plexes /dev/vinum/sd directory containing device nodes for vviinnuumm subdisks EENNVVIIRROONNMMEENNTT VINUM_HISTORY The name of the log file, by default _/_v_a_r_/_l_o_g_/_v_i_n_u_m___h_i_s_t_o_r_y. VINUM_DATEFORMAT The format of dates in the log file, by default "%e %b %Y %H:%M:%S". EDITOR The name of the editor to use for editing configuration files, by default vvii. SSEEEE AALLSSOO strftime(3), vinum(4), disklabel(8), newfs(8) _h_t_t_p_:_/_/_w_w_w_._v_i_n_u_m_v_m_._o_r_g_/_v_i_n_u_m_/, _h_t_t_p_:_/_/_w_w_w_._v_i_n_u_m_v_m_._o_r_g_/_v_i_n_u_m_/_h_o_w_-_t_o_-_d_e_b_u_g_._h_t_m_l. AAUUTTHHOORRSS Greg Lehey HHIISSTTOORRYY The vviinnuumm utility first appeared in FreeBSD 3.0. The RAID-5 component of vviinnuumm was developed for Cybernet Inc. (_w_w_w_._c_y_b_e_r_n_e_t_._c_o_m) for its NetMAX product. FreeBSD 5.0 December 20, 2000 FreeBSD 5.0