.TH VENTIPROG 8
.SH NAME
ventiprog,
cpsys,
fosreset,
fossilize,
fossilstart,
foshalt \- backup between ventis, replicate fossils, and archive rootscores
.SH SYNOPSIS
.PP
.B ventiprog
[
.I ventilist
]
.PP
.B cpsys
.I source
.I dest
.PP
.B fosreset
.I rootscore
[
.I partition
]
[
.I ventiaddr
]
.PP
.B fossilize
[
.I partition
]
.PP
.B fossilstart
[
.I partition
]
[
.I srvname
]
.PP
.B foshalt
.PP
.B /n/9fat/rootscor
.PP
.B /n/9fat/wrcmd
.SH DESCRIPTION
These commands aid in the maintenance and replication of
venti/fossil servers. See
.IR fossil (4)
and
.IR fossilcons (8)
for an overview of the fossil system, fossil/last, flfmt -v, and
.IR venti (8)
and
.IR venti-backup (8)
for an overview of venti and replication with wrarena.
.PP
Note that these commands make certain assumptions about system
configuration and require some manual setup and additional
administrative actions for use as a complete backup/replication workflow.
As with all system administration scripts, please study their interaction with
your local environment before use. 
.SS Overview
These scripts help perform the workflow of replicating between active ventis, replicating fossils that make use of them, and preserving the fossil rootscores. There is a set sequence of operations to correctly replicate active venti/fossil systems. First, and not automated by these scripts, an active 
.IR fossil (4)
must be taking snapshots. This happens automatically, or can be triggered by sending the comand
.B fsys main snap -a
to the fossil console. The workflow of 
.IR ventiprog 
and related commands assumes that the desired snapshot operation has been completed.
.SS Venti replication
After the desired snapshot is finished (which may simply be the automatic daily snapshot) the
.IR fossilize
of a given
.I partition
prints the output of 
.IR fossil/last 
, mounts a 
.I 9fat 
partition if necessary, and
appends the rootscore to 
.I /n/9fat/rootscor
which is taken as a conventional storage location for fossil rootscores and venti offset data. Rootscores need to be kept secure so this file should be treated in the same manner as nvram.
.PP
After a snapshot has been completed and the rootscore saved, replicating data from the venti used by that fossil to other ventis will make that rootscore available for use. The task of progressively replicating data between ventis is given to the
.IR ventiprog
script which takes an optional list of
.I targetventis
to direct the data replication. Prior to using 
.IR ventiprog
, the user must create the file
.B /n/9fat/wrcmd
which contains a venti/wrarena command with the correct arena offset. As described by
.IR venti-backup (8)
this command will take a form such as:
"wrarena -h tcp!ip.of.venti.server!17034 -o 537665536 /dev/sdC0/arenas 0x0"
to begin. The first parameter to -o is calculated by subtracting 8192 from the location of venti partition as retrieved from the 
.I /index 
file of the venti http server. Each time 
.IR ventiprog 
is run it updates this command with a new final clump offset parameter. It is the user's responsibility to note when a venti arenas partition is filled and adjust the -o parameter and reset the final parameter to 0x0.
.SS Fossil replication
Resetting running fossils to a different score and replicating fossils between systems is done with
.IR fosreset
, which uses
.I vacscore
to 
.IR flfmt -v 
the given
.I partition 
using the
.I ventiaddr
given. If no parameter is provided the environment value of 
.B $venti 
will be used and if a partition is absent
.I /dev/sdC0/fossil
will be used as a default. The script first uses the simplified fossil-only
.IR foshalt
script to sync and halt the fossil, then kills all running fossil processes before issuing the 
.IR flfmt -v 
command. 
.PP
.IR cpsys
automates replicating between the fossil of
.I source
system and that of
.I dest
system. IMPORTANT: this script assumes that the partition identification is the same on both systems. It also requires the
.IR rexexec (8)
service to be listening on both source and destination machines. It issues the 
.IR fossilize 
command to 
.I source
and saves the output to create the parameters for a 
.IR fosreset 
command sent to 
.I dest.
.PP
Because running fossils are halted by the actions of 
.IR fosreset 
and 
.IR cpsys
, the
.IR fossilstart
script assists in restating the fossil located on a given
.I partition
using standard default parameters. If
.I srvname
is given, it will be used as a stem for the fossil file 
.I/srv 
and also its 
.IR fossilcons (8)
.SH EXAMPLE
These commands are issued from the service namespace of a 
.IR venti (8)
server.
.IP
.EX
% rx fileserver echo fsys main snap -a '>>/srv/fscons' 
# begin a snap and then wait for it to complete

% rx fileserver fossilize >>/n/9fat/rootscor 
# saves the rootscore both on the file and venti server

% ventiprog $ventis 
# assumes the user has a variable in the environment like
# ventis=(ip.addr.one ip.addr.two ip.addr.three)

% cp /n/9fat/rootscor /n/remote/backup 
# copy the rootscores to the backup venti hosts

% cpsys fileserver backupserver 
# reset the backup fossil to the rootscore of the snapshot
.EE
.PP
After this seequence, the backup server can choose to use one of the ventis which also contains the replicated rootscore. Usually this is done by changing the value of the 
.B $venti 
variable in 
.IR plan9.ini (8)
.SH SOURCE
.B sources/mycroftiv/rootlessnext/scripts
.SH SEE ALSO
.IR fossil (4),
.IR fossilcons (8),
.IR venti (8),
.IR venti-backup (8)
.SH BUGS
.I ventiprog
should automate the construction of the wrcmd from the venti http/index file.
