cbu

CBU
---

This is a suite of tools for backing up one's home directory to CDROM.

It's probably also quite useful for other directory trees, and/or to
put stuff on DVD-ROM or similar suchlike media.

#  Copyright (C) 2003, 2004 Anthony de Boer
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of version 2 of the GNU General Public License as
#  published by the Free Software Foundation.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

NOTICE: this is presently alpha-quality stuff; some refinement is
still expected, and there's not yet a complete restore script.

General theories: if we remember what's previously been backed up, then
we only have to do incrementals.  Usually we generate less than a
CDROM worth of new stuff a week, so we want a rolling backup such that
the last several CDs have everything and we don't have to go back to
the dawn of time to do a restore.  Having new files recorded at least
a couple of times gives redundancy.  We track file uniqueness via
MD5 checksums to know what's changed and only need to keep one copy
of files that are duplicated.

cbu-init : creates a .cbu subdirectory under the current directory and
populates it.  Use once only.  Note that all cbu commands assume the
working root is the current directory and that the .cbu subdirectory
is here.

cbu-diskcat : generates a catalogue of what's currently in your
directory.  This takes awhile, as it's running md5sum(1) on everything
the first time.  Note that on subsequent runs it assumes an unchanged
md5sum on files whose size, last-modified-time, owner, group, and
permissions haven't changed; deleting .cbu/fileperms.gz will remove
its cache and force a full re-cataloging.  Execs cbu-gensets when
done.

cbu-gensets : generates cd-cutting lists.  Run after cbu-diskcat.  It
produces output that looks like:

  Files on 000: 1274 (prio 1 11)
  Files on 001: 1260 (prio 1)
  Files on 002: 1192 (prio 1 2)
  Files on 003: 1086 (prio 1 5)
  Files on 004: 875 (prio 1 2 3 5)
  Files on 005: 1106 (prio 2)
  Files on 006: 568 (prio 2 3 4)
  Files on 007: 1992 (prio 2 3 4 5)

This is the program that decides what to back up; lower priority numbers
are more-important files, and are taken first, with the balance of each
CD filled with less-important files.  If there's no room to fit any more
large files from a given priority, smaller files from lesser priorities
would be used instead.

The present algorithm simply takes the number of times a file has already
been archived as the priority, so that priority-0 are new files (the
output above was taken when that machine had just been backed up), and
priority 11 has been backed up 11 times.  

(Note: there's *always* room for an empty file to squeeze onto every CD,
and that's why one sample empty file gets backed up everytime and you have
that 11, or the number of previous CDs you've cut, showing there.)

Typically you'd only write enough CDROMs to get all the priority-0
files backed up, but could continue and get the priority-1 ones as well
for redundancy.  Cutting all eight CDs whose filelists were generated
above would be done only if you needed a full backup.

cbu-burnset NNN : generates a .iso for CD NNN.  Note that it uses cpio
-pl to generate a tree of hardlinks to the selected files, with
.cbu/tmp/NNN as the root, then runs mkisofs on that.  You'll find NNN.iso
in $TMPDIR if set, or .cbu/tmp otherwise.  You'll need to invoke cdrecord
on this file manually (and this may be the one step you have to do as
root).

cbu-cdcat CDID : catalogues a CDROM.  Has the side-benefit of verifying
the newly-written CD is actually readable.  The CDID should be an
alphanumeric string identifying the CDROM (and should get written on its
label as well).  Try hostnameYYYYMMDD or somesuch.

cbu-genzero : an alternate, writes the list of not-yet-backed-up files
to STDOUT, suitable for cpio'ing up and taking to a machine that has a
burner.

cbu-duplicates : outputs a list of alternate paths to files.



cbu-0.0.tar.gz18 Feb 200310611
cbu-0.1.tar.gz22 Feb 200413556
cbu-0.3.tar.gz7 Aug 200619465
cbu-0.4.tar.gz15 Mar 200720704

Project Index