2 # restore arena# [dev] - load venti with arenas on dev, stored one per track
3 # starting with arena#. must have run fmtarenas before restoring
4 # the first arena in the partition.
5 # this must be run on the venti server, without venti running on the
6 # affected arena partition(s).
8 if (test -e /sys/lib/backup/funcs)
9 . /sys/lib/backup/funcs
15 echo usage: $0 arena-num '[dev]' >[1=2]
19 if (! ~ $starena [0-9] [0-9][0-9] [0-9][0-9][0-9]) {
20 echo $0: bad starting arena: $starena >[1=2]
24 # clear any dregs from a previous run
25 unmount /mnt/cd >[2]/dev/null
32 #for (track in d[0-9]*)
33 # venti/wrarena $track # slow; takes about 12½ mins. per GB
36 # set arenabase for arenastart
37 arenabase = `{ venti/printarenapart $arenas | sed -e 's/.*arenabase=//' -e 1q }
38 kill printarenapart | rc # printarenapart leaves a process behind
39 # echo arenabase $arenabase
42 for (track in d[0-9]*) {
43 if (~ track 'd[0-9]*') {
44 echo $0: no tracks in /mnt/cd >[1=2]
47 if (~ $skipping yes) {
48 # verify that first track is the expected one
52 name=`{ venti/printarena $track >[2=1] |
53 sed -e 's/.*name=([^ =]+).*/\1/' -e 1q }
55 name=NOT-A-VENTI-ARENA
57 kill printarena | rc # printarena leaves a process behind
59 echo -n first track is $"name'; is that right? '
66 echo aborting, arena is unchanged. >[1=2]
71 if (! ~ $skipping yes) {
72 # copy each track into its slot in the arena partition
73 venti/printarena $track >[2=1] | sed 1q | tr -d '\12'
74 kill printarena | rc # printarena leaves a process behind
76 off = `{arenastart $arena}
77 # echo -n writing $track to $arenas at 8K-block offset $off:
80 # argh! something (cdfs?) appends 60K of *stuff* to each
81 # arena on optical disc. restrain dd.
82 count=`{ echo $arenasize/$blocksize | bc }
83 pump -i 1048576 -o 65536 -d 10 <$track |
84 dd -quiet 1 -count $count -bs $blocksize -of $arenas \
86 arena = `{hoc -e $arena+1}
89 # when all done, must run venti/checkarenas, fmtisect, fmtbloom, fmtindex,
90 # and (the big one) venti/buildindex -b /cfg/pie/venti.conf