2014

JanFebMarApr
MayJunJulAug
SepOctNovDec

2013

JanFebMarApr
MayJunJulAug
SepOctNovDec

more...

2011

JanFebMarApr
MayJunJulAug
SepOctNovDec

2010

JanFebMarApr
MayJunJulAug
SepOctNovDec

2009

JanFebMarApr
MayJunJulAug
SepOctNovDec

2008

JanFebMarApr
MayJunJulAug
SepOctNovDec

2007

JanFebMarApr
MayJunJulAug
SepOctNovDec

2006

JanFebMarApr
MayJunJulAug
SepOctNovDec

2005

JanFebMarApr
MayJunJulAug
SepOctNovDec

2004

JanFebMarApr
MayJunJulAug
SepOctNovDec

2003

JanFebMarApr
MayJunJulAug
SepOctNovDec

Photolog

Through the Looking-Glass
2010-10-12: Through the Looking-Glass
My radio speaks is binary!
2010-10-10: My radio speaks is binary!
Gigaminx: (present for my birthday)
2010-09-16: Gigaminx: (present for my birthday)
Trini on bike
2010-09-05: Trini on bike
Valporquero
2010-08-28: Valporquero
My new bike!
2010-08-22: My new bike!
Mario and Ana's wedding
2010-08-13: Mario and Ana's wedding
Canyoning in Guara
2010-08-07: Canyoning in Guara
Trini and Mari in Marbella
2010-08-05: Trini and Mari in Marbella
Trini and Chelo in Tabarca
2010-08-03: Trini and Chelo in Tabarca
Valid XHTML 1.1
Log in

Let's say you have a venti server and you would like to mirror its contents to another one. How to do it?

First, you will need to have another venti configured. Please look at the venti(8) manual page to know how to do it, or see my post on how to set up a venti server. Please note that, if you want to run both servers at the same time, and if they are in the same machine, they must listen to different port numbers.

There are several ways to copy the contents of a venti server into another:

  • venti-copy

    With venti-copy you can copy an entire tree of blocks from one venti server to another. Both servers must be running in order to copy the blocks.

    If you have the list of scores all the trees in the file scores.txt, you could use the following command to start copying:

    cat scores.txt | while read score ; do venti-copy $venti1 $venti2 $a ; done

    Advantages: you don't need to stop either server; arena partitions in each server can have different geometry

    Disadvantages: it is very slow, and you need to know a priori the list of VtRoot scores you want to copy.

  • venti-mirrorarenas

    This command can be used to copy every arena from one arena partition to another. Both servers should be stopped.

    Advantages: it is very fast, and there are several tests to check that the arena geometries are the same.

    Disadvantages: it only works if source and destination have exactly the same number of arenas of the same size; after finishing the copy, you must use venti-buildarenas in the destination server.

  • venti-rdarena and venti-wrarena

    venti-rdarena reads one arena from a venti server and writes it to standard output; venti-wrarena writes an arena from a file to a venti server.

    In order to mirror one venti server, you could read all its arenas with venti-rdarena, one by one, and then write them to another server with venti-wrarena. Both servers should be stopped.

    Advantages: it works even if source and destination have different number of arenas; it is faster than venti-copy.

    Disadvantages: it only works if source and destination have arenas of the same size; it is very slow if your venti servers have a lot of arenas (each invocation of these executables read all the arena map); after finishing the copy, you must use venti-buildarenas in the destination server.

  • Copy all the arenas by hand

    If you figure out the position in the arena partition of each arena, and its size, you can yust copy the arenas with dd. Both servers should be stopped.

    For example, if you formatted the arena partitions with the default arenasize and blocksize, then the arenas will have 512MB (536870912 bytes), and will be located in the position 794624 + 536870912*n. So, you could use the following loop to copy arenas $start to $end, from file $orig to $dest:

    for i in $( seq $start $end )
    do
      echo "Copying arena $i from $start to $end..."
      skip=$(( 97 + $i * 65536 ))
      dd if="$orig" bs=8192 skip=$skip count=65536 seek=$skip of="$dest"
    done

    Advantages: it is very fast.

    Disadvantages: it only works if source and destination have arenas of the same size; you have to make sure that the arenas are located exactly where you are reading and writting them; after finishing the copy, you must use venti-buildarenas in the destination server.

Labels: Plan 9 venti

To set up a venti server, you can read the manual pages, or follow these simple rules. You need, at least, three things:

  1. A configuration file (usually called venti.conf)
  2. one arena partition
  3. one index section

The configuration file is a text file which tells the server where to find the rest of the files, how much memory to use, where to listen for client requests... This file consits of lines with two words each: a reserved word, and a parameter. The simplest configuration file is:

index main
arenas /path/to/arenas
isect /path/to/index

The config file can have more lines:

  • There can be more than one arena partition (more arenas lines)
  • There can be more than one index section (more isect lines)
  • bloom /path/to/bloom

    Bloom filter, optional file that is stored on disk but also kept completely in memory while the venti server runs. It helps the venti server efficiently detect scores that are not already stored in the index.

  • mem size

    lump cache sizelumps, which holds recently-accessed venti data blocks. The default value is 1MB.

  • bcmem size

    block cache size

  • icmem size

    index cache size

  • addr netaddr

    Network address to announce venti service (default tcp!*!venti)

  • httpaddr netaddr

    Network address to announce HTTP service

All the sizes are specified in bytes, and the amount can be appended by a k, m o g to indicate kilobytes, megabytes or gigabytes.

The file names can be expressed as file:lo-hi to specify a range of bytes within the file. Either lo or hi may be omitted, to indicate the beginning and the end of the file, respectively.

The arena partition (/path/to/arenas) holds, in sequential order, the contents of every block written to the server. It is logically split into sections called arenas, each of one has 500MB.

The index section (/path/to/index) helps locate a block in the arena partitions given its score. The suggested index size is 5% of the arena partition.

In order to start the server, you must format the arena partition and the index section first; then, you have to format the main index:

venfi-fmtisect isect0. /path/to/index
venti-fmtarenas arenas0. /path/to/arenas
venti-fmtindex venti.conf

And that's all! You can now start the venti server by running venti.

For those of you that still don't know venti, I will say that it is a network storage system, heavily used in Plan 9 from Bell Labs and, thanks to Russ Cox, it is part of plan9port (Plan 9 from User Space), and hence it can be used in other operating systems.

Venti is a block storage server intended for archival data. In a Venti server, the SHA1 hash of a block’s contents acts as the block identifier for read and write operations. This approach enforces a write-once policy, preventing accidental or malicious destruction of data. In addition, duplicate copies of a block are coalesced, reducing the consumption of storage and simplifying the implementation of clients.

Venti is the system I use for back-ups of all our Linux machines at work; it is very easy to use, very efficient and very useful. The only problems I see is that it is not yet packaged in Debian, and its compilation and installation is not very straightforward; that is why I packaged it for Debian, creating 2 packages:

  • venti-server: It includes the server (venti) and some utilities to create and configure it.
  • venti-client: Some clients that talk to a venti server, such as vbackup, vac and vnfs.

I packaged version 20100416-1, but it is not published anywhere yet (but drop me a note if you would like to get it).