9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] more fun with venti
@ 2002-12-13  8:33 Russ Cox
  0 siblings, 0 replies; only message in thread
From: Russ Cox @ 2002-12-13  8:33 UTC (permalink / raw)
  To: 9fans

Some more utilities for managing your Venti server(s).

First, venti/copy moves a whole block tree from one
Venti server to another.  You give it the hash for a block
and it copies that block as well as all the blocks pointed
at, and so on.  See ventiaux(8) for the full story.
For example, if you just did vac -h thisventi and got
vac:b5b95f71c552bfa785c6200c5c928ffc52d41edb
then you could run

	venti/copy thisventi thatventi b5b95f71c552bfa785c6200c5c928ffc52d41edb

to move the whole tree over to thatventi.

Second, the shell script /sys/src/cmd/venti/backup.example
uses venti/wrarena to incrementally backup one Venti
server onto another.  For example, I use this variant of it to copy
from my laptop's local Venti server to my desktop machine's
local Venti server (which eventually gets copied onto CDs).

	#!/bin/rc

	rfork e
	venti=192.168.0.51
	. bkup.info
	fn x {
		echo x $*
		y=$1
		if(~ $#$y 0){
			$y=0
		}
		echo venti/wrarena -o $2 $3 $$y
		end=`{venti/wrarena -o $2 $3 $$y | grep '^end offset ' | sed 's/^end offset //'}
		if(~ $#end 1 && ! ~ $$y $end){
			$y=$end
			whatis $y >>bkup.info
		}
	}
	hget http://127.1:8000/index |
	awk '
	/^index=/ { blockSize=0+substr($3, 11); }
	/^arena=/ { arena=substr($1, 7); }
	/^	arena=/ { start=0+substr($5, 2)-blockSize; printf("x %s %d %s\n", arena, start, $3); }
	' |rc

It's a little rough, but good enough to run in a nightly
cron job.

Russ



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-12-13  8:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-13  8:33 [9fans] more fun with venti Russ Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).