Dump-like file system backup for Unix, built on Venti.

This commit is contained in:
rsc 2005-07-13 03:49:41 +00:00
parent 0c98da8bf8
commit 004aa293f3
27 changed files with 4437 additions and 0 deletions

78
man/man1/hist.1 Normal file
View file

@ -0,0 +1,78 @@
.TH HIST 1
.SH NAME
hist \- print file names from the dump
.SH SYNOPSIS
.B hist
[
.B -vdu
] [
.B -s
.I yyyymmdd
]
.I files ...
.SH DESCRIPTION
.I Hist
prints the names, dates, and sizes of all versions of the named
.IR files ,
looking backwards in time,
stored in the dump file system.
If the file exists in the main tree, the first line of output will be its current state.
For example,
.IP
.EX
hist ~rsc/.bash_history
.EE
.PP
produces
.IP
.EX
.nf
May 19 16:11:37 EDT 2005 /home/am3/rsc/.bash_history 6175
May 18 23:32:16 EDT 2005 /dump/am/2005/0519/home/am3/rsc/.bash_history 5156
May 17 23:32:31 EDT 2005 /dump/am/2005/0518/home/am3/rsc/.bash_history 5075
May 16 07:53:47 EDT 2005 /dump/am/2005/0517/home/am3/rsc/.bash_history 5065
.fi
.EE
.PP
The
.B -v
option enables verbose debugging printout.
.PP
The
.B -d
option causes
.IR diff (1)
.B -c
to be run for each adjacent pair of dump files, while
.B -b
runs
.IR diff
.BR -cb .
.PP
The
.B -u
option causes times to be printed in GMT (UT) rather than local time.
.PP
Finally, the
.B -s
option
sets the starting (most recent) date for the output.
.SH EXAMPLES
.PP
Examine changes in block.c:
.IP
.EX
hist -d block.c
.EE
.SH FILES
.B /dump
.SH SOURCE
.B /home/am3/rsc/src/backup/cmd/history.c
.SH SEE ALSO
.IR yesterday (1)
.SH BUGS
Should be called
.IR history ,
but
that name is taken by
.IR sh (1).

263
man/man1/vbackup.1 Normal file
View file

@ -0,0 +1,263 @@
.TH VBACKUP 8
.SH NAME
vbackup, vcat, vftp, vmount, vmount0, vnfs \-
back up Unix file systems to Venti
.SH SYNOPSIS
.B vbackup
[
.B -DVnv
]
[
.B -s
.I secs
]
[
.B -w
.I n
]
.I disk
[
.I score
]
.PP
.B vcat
[
.B -z
]
.I disk
|
.I score
.B >
.I disk
.PP
.B vftp
.I disk
|
.I score
.PP
.B vmount
[
.B -v
]
.I addr
.I mtpt
.PP
.B vmount0
[
.B -v
]
[
.B -h
.I handle
]
.I addr
.I mtpt
.PP
.B vnfs
[
.B -LLMRVr
]
[
.B -a
.I addr
]
[
.B -m
.I mntaddr
]
[
.B -b
.I blocksize
]
[
.B -c
.I cachesize
]
.I config
.SH DESCRIPTION
These programs back up and restore standard
Unix file system images stored in
.IR venti (8).
Images stored in
.I venti
are named by
.IR scores ,
which consist of a file system type followed
by a colon and forty hexadecimal digits, as in:
.IP
.EX
ffs:0123456789abcdef0123456789abcdef01234567
.EE
.PP
(The hexadecimal data is the SHA1 hash of the Venti
root block representing the file system image.)
.PP
These programs expect the environment variable
.B $venti
to be set to the network address of the Venti server to use
(for example,
.B yourhost
or
.BR tcp!yourhost!venti ).
.PP
.I Vbackup
copies the file system stored on
.I disk
to the Venti server and prints the
score for the newly-stored image.
The argument
.I disk
should be a disk or disk partition device
that would be appropriate to pass to
.IR mount (8).
.PP
The optional argument
.I score
is the score of a previous backup of the disk image.
If
.I score
is given,
.I vbackup
will not write to Venti any blocks that have not changed
since the previous backup.
This is only a speed optimization: since the blocks are already
stored on Venti they need not be sent to the Venti server again.
.PP
The options to
.I vbackup
are:
.TP
.B -D
.TP
.B -V
.TP
.B -n
.TP
.B -v
.TP
.B -w \fIn
.TP
.B -s \fIsecs
.PP
.I Vcat
writes the named disk image to standard output.
Unused file system blocks are printed zeroed regardless
of their actual content.
.PP
If the
.B -z
flag is given,
.I vcat
will attempt to seek over unused blocks instead of writing to them.
The
.B -z
flag should only be used when standard output is seekable
.RI ( i.e. ,
when it has been redirected to a file or disk).
.PP
.I Vftp
presents the
file system image named by
.I disk
or
.I score
in a shell-like
interactive session.
Type
.B help
at the
.B vftp>
prompt for details.
.PP
.I Vmount
mounts the NFS service at the network connection
.I address
onto
.IR mountpoint .
On most operating systems,
.I vmount
must be run by the user
.BR root .
.PP
.I Vmount0
is a simple C program that
.I vmount
uses if
.IR mount (8)
does not suffice.
.PP
.I Vnfs
serves, using the
NFS version 3 protocol,
one or more disk images in a synthetic tree defined
by the configuration file
.IR config .
.I Vnfs
announces NFS service at
.IR addr
(default
.BR udp!*!nfs )
and NFS mount service at
.IR mntaddr
(default
.BR udp!*!\fI999 ),
registering both with the port mapper.
If no port mapper is found running (on port 111),
.I vnfs
starts its own port mapper.
The options are:
.TP
.B -r
Reply to all NFS requests with RPC rejections.
.TP
.B -M
Do not announce an NFS mount service.
.TP
.B -P
Do not register service with the port mapper.
.TP
.B -a
.SH EXAMPLES
.PP
Back up the file system stored on
.BR /dev/da0s1a :
.IP
.EX
% vbackup /dev/da0s1a
ffs:0123456789abcdef0123456789abcdef01234567
%
.EE
.PP
Serve that backup and a few others in a tree reminiscent
of Plan 9's dump file system, but hide each day's contents of
.B /tmp :
.IP
.EX
% cat config
mount /2005/0510 ffs:0123456789abcdef\fI...\fP
mount /2005/0510/home ffs:0123456789abcdef\fI...\fP
mount /2005/0510 ffs:0123456789abcdef\fI...\fP
mount /2005/0510/home ffs:0123456789abcdef\fI...\fP
hide /*/*/tmp
% vnfs -m -b 16k -c 1k config
%
.EE
.PP
Mount the backups on a client machine using
.IR vmount :
.IP
.EX
# vmount udp!yourserver!nfs /dump
# ls /dump
2005
#
.EE
.PP
Mount the backups using the standard NFS mount program:
.IP
.EX
# mount -t nfs -o soft,intr,ro,nfsv3,rsize=8192,timeo=100 \
-o nfsvers=3,nolock,noatime,nodev,nosuid \
.EE

99
man/man1/yesterday.1 Normal file
View file

@ -0,0 +1,99 @@
.TH YESTERDAY 1
.SH NAME
yesterday \- print file names from the dump
.SH SYNOPSIS
.B yesterday
[
.B -cCd
] [
.B -n
.I daysago
] [
.I \-date
]
.I files ...
.SH DESCRIPTION
.I Yesterday
prints the names of the
.I files
from the most recent dump.
Since dumps are done early in the morning,
yesterday's files are really in today's dump.
For example, if today is February 11, 2003,
.IP
.EX
yesterday /home/am3/rsc/.profile
.EE
.PP
prints
.IP
.EX
/dump/am/2003/0211/home/am3/rsc/.profile
.EE
.PP
In fact, the implementation is to select the most recent dump in
the current year, so the dump selected may not be from today.
.PP
By default,
.I yesterday
prints the names of the dump files corresponding to the named files.
The first set of options changes this behavior.
.TP
.B -c
Copy the dump files over the named files.
.TP
.B -C
Copy the dump files over the named files only when
they differ.
.TP
.B -d
Run
.B diff
to compare the dump files with the named files.
.PP
The
.I date
option selects other day's dumps, with a format of
1, 2, 4, 6, or 8 digits of the form
.IR d,
.IR dd ,
.IR mmdd ,
.IR yymmdd ,
or
.IR yyyymmdd .
.PP
The
.B -n
option selects the dump
.I daysago
prior to the current day.
.PP
.I Yesterday
does not guarantee that the string it prints represents an existing file.
.SH EXAMPLES
.PP
See what's changed in the last week in your profile:
.IP
.EX
yesterday -d -n 7 ~/.profile
.EE
.PP
Restore your profile from yesterday:
.IP
.EX
yesterday -c ~/.profile
.EE
.SH FILES
.B /dump
.SH SOURCE
.B /usr/local/bin/yesterday
.SH SEE ALSO
.IR diff (1),
.IR hist (1)
.SH BUGS
Backups are only available on
.B amsterdam
and
.BR toil .
.PP
It's hard to use this command without singing.