VENTIAUX(8)

NAME
buildindex, checkarenas, checkindex, conf, copy, fmtarenas, fmtindex, fmtisect, rdarena, rdarenablocks, read, wrarenablocks, write - Venti maintenance and debugging commands

SYNOPSIS
venti/buildindex [ -B blockcachesize ] [ -Z ] venti.config tmp

venti/checkarenas [ -afv ] file

venti/checkindex [ -f ] [ -B blockcachesize ] venti.config tmp

venti/conf [ -w ] partition [ configfile ]

venti/copy [ -f ] src dst score [ type ]

venti/fmtarenas [ -Z ] [ -a arenasize ] [ -b blocksize ] name file

venti/fmtindex [ -a ] venti.config

venti/fmtisect [ -Z ] [ -b blocksize ] name file

venti/rdarena [ -v ] arenapart arenaname

venti/read [ -h host ] score [ type ]

venti/wrarena [ -o fileoffset ] [ -h host ] arenafile [ clumpoffset ]

venti/write [ -h host ] [ -t type ] [ -z ]

DESCRIPTION
These commands aid in the setup, maintenance, and debugging of Venti servers. See venti(8) and venti.conf(6) for an overview of the data structures stored by Venti.

Note that the units for the various sizes in the following commands can be specified by appending or to indicate kilobytes, megabytes, or gigabytes respectively.

Buildindex populates the index for the Venti system described in venti.config. The index must have previously been formatted using fmtindex. This command is typically used to build a new index for a Venti system when the old index becomes too small, or to rebuild an index after media failure. Small errors in an index can usually be fixed with checkindex.

The tmp file, usually a disk partition, must be large enough to store a copy of the index. This temporary space is used to perform a merge sort of index entries generated by reading the arenas.

Options to buildindex are:

-B blockcachesize
    The amount of memory, in bytes, to use for caching raw disk accesses while running buildindex. (This is not a property of the created index.) The default is 8k.

-Z  Do not zero the index. This option should only be used when it is known that the index was already zeroed.

Checkarenas examines the Venti arenas contained in the given file. The program detects various error conditions, and optionally attempts to fix any errors that are found.

Options to checkarenas are:

-a  For each arena, scan the entire data section. If this option is omitted, only the end section of the arena is examined.

-f  Attempt to fix any errors that are found.

-v  Increase the verbosity of output.

Checkindex examines the Venti index described in venti.config. The program detects various error conditions including: blocks that are not indexed, index entries for blocks that do not exist, and duplicate index entries. If requested, an attempt can be made to fix errors that are found.

The tmp file, usually a disk partition, must be large enough to store a copy of the index. This temporary space is used to perform a merge sort of index entries generated by reading the arenas.

Options to checkindex are:

-B blockcachesize
    The amount of memory, in bytes, to use for caching raw disk accesses while running checkindex. The default is 8k.

-f  Attempt to fix any errors that are found.

Fmtarenas formats the given file, typically a disk partition, into a number of Venti arenas. The arenas are given names of the form name%d, where %d is replaced with a sequential number starting at 0.

Options to fmtarenas are:

-a arenasize
    The arenas are of arenasize bytes. The default is 512 megabytes, which was selected to provide a balance between the number of arenas and the ability to copy an arena to external media such as recordable CDs and tapes.

-b blocksize
    The size, in bytes, for read and write operations to the file. The size is recorded in the file, and is used by applications that access the arenas. The default is 8k.

-Z  Do not zero the data sections of the arenas. Using this option reduces the formatting time but should only be used when it is known that the file was already zeroed. Fmtindex takes the venti.conf(6) file venti.config and initializes the index sections to form a usable index structure. The arena files and index sections must have previously been formatted using fmtarenas and fmtisect respectively.

The function of a Venti index is to map a SHA1 fingerprint to a location in the data section of one of the arenas. The index is composed of blocks, each of which contains the mapping for a fixed range of possible fingerprint values. Fmtindex determines the mapping between SHA1 values and the blocks of the collection of index sections. Once this mapping has been determined, it cannot be changed without rebuilding the index. The basic assumption in the current implementation is that the index structure is sufficiently empty that individual blocks of the index will rarely overflow. The total size of the index should be about 2% to 10% of the total size of the arenas, but the exact depends both the index block size and the compressed size of block stored to Venti.

Fmtindex also computes a mapping between a linear address space and the data section of the collection of arenas. The -a option can be used to add additional arenas to an index. To use this feature, add the new arenas to venti.config after the existing arenas and then run fmtindex -a.

A copy of the above mappings is stored in the header for each of the index sections. These copies enable buildindex to restore a single index section without rebuilding the entire index.

Fmtisect formats the given file, typically a disk partition, as a Venti index section with the specified name. One or more formatted index sections are combined into a Venti index using fmtindex. Each of the index sections within an index must have a unique name.

Options to fmtisect are:

-b blocksize
    The size, in bytes, for read and write operations to the file. All the index sections within a index must have the same block size. The default is 8k.

-Z  Do not zero the index. Using this option reduces the formatting time but should only be used when it is known that the file was already zeroed.

Rdarena extracts the named arena from the arena partition arenapart and writes this arena to standard output. This command is typically used to back up an arena to external media. The -v option generates more verbose output on standard error.

Wrarena writes the blocks contained in the arena arenafile (typically, the output of rdarena) to a Venti server. It is typically used to reinitialize a Venti server from backups of the arenas. For example,

        venti/rdarena /dev/sdC0/arenas arena.0 >external.media
        venti/wrarena -h venti2 external.media

writes the blocks contained in arena.0 to the Venti server venti2 (typically not the one using /dev/sdC0/arenas).

The -o option specifies that the arena starts at byte fileoffset (default 0) in arenafile . This is useful for reading directly from the Venti arena partition:

        venti/wrarena -h venti2 -o 335872 /dev/sdC0/arenas

(In this example, 335872 is the offset shown in the Venti server's index list (344064) minus one block (8192). You will need to substitute your own arena offsets and block size.)

Finally, the optional offset argument specifies that the writing should begin with the clump starting at offset within the arena. Wrarena prints the offset it stopped at (because there were no more data blocks). This could be used to incrementally back up a Venti server to another Venti server:

        last=`{cat last}
        venti/wrarena -h venti2 -o 335872 /dev/sdC0/arenas $last >output
        awk '/^end offset/ { print $3 }' offset >last

Of course, one would need to add wrapper code to keep track of which arenas have been processed. See /sys/src/cmd/venti/backup.example for a version that does this.

Read and write read and write blocks from a running Venti server. They are intended to ease debugging of the server. The default host is the environment variable $venti, followed by the network metaname $venti. The type is the decimal type of block to be read or written. If no type is specified for read , all types are tried, and a command-line is printed to show the type that eventually worked. If no type is specified for write , VtDataType (13) is used. Read reads the block named by score (a SHA1 hash) from the Venti server and writes it to standard output. Write reads a block from standard input and attempts to write it to the Venti server. If successful, it prints the score of the block on the server.

Copy walks the entire tree of blocks rooted at score , copying all the blocks visited during the walk from the Venti server at network address src to the Venti server at network address dst . If type (a decimal block type for score) is omitted, all types will be tried in sequence until one is found that works. The -f flag runs the copy in ``fast'' mode: if a block is already on dst, the walk does not descend below it, on the assumption that all its children are also already on dst. Without this flag, the copy often transfers many times more data than necessary.

To make it easier to bootstrap servers, the configuration file can be stored at the beginning of any Venti partitions using conf. A partition so branded with a configuration file can be used in place of a configuration file when invoking any of the venti commands. By default, conf prints the configuration stored in partition. When invoked with the -w flag, conf reads a configuration file from configfile (or else standard input) and stores it in partition.

SOURCE
/sys/src/cmd/venti

SEE ALSO
venti(8), venti.conf(6)

BUGS
Buildindex should allow an individual index section to be rebuilt. The merge sort could be performed in the space used to store the index rather than requiring a temporary file.