Appendable Tapes

Situation

  Imagine a situation where you have some hosts to backup, you're
  doing a daily incremental scheme, and the week's backups will fit
  easily onto one tape.  You'd like to just load a tape in the drive
  at the start of the week and run the week's backups onto it through
  cron.

  The current version of the backup system (2.6) wouldn't support this
  well since it doesn't know how to skip to the end of a tape that
  already has data on it, and because it rewrites the tape label at
  the start of each run, which destroys the previous contents of the
  tape.

Implementation Ideas

  Add an extra flag to all-backups which indicates that we should
  append to the tape instead of starting at the beginning.  The chunk
  of code that rewrites the tape label would have to be redone so that
  if this were a normal run we'd rewrite the label, otherwise we'd
  skip to the end of the tape:

    check label

    if ! appending
	rewrite label
	set file number = 1
    else 
	skip-to-end-of-recorded-media
	set file number = X

  skip-to-end-of-recorded-media is a routine that would skip to the
  end of the recorded media in the best way possible.  If the tape is
  on a host where "mt eom" works and "mt status" reports the file
  position accurately, then we can just use those.  We'd have to add a
  note to each tape host description indicating whether eom works
  reliably or not (similarly to the mt status flag).  Otherwise, we
  should get the last-file-number from the tape entry and use "mt fsf
  N+1" to skip forward past the last file.  Its possible that we might
  be able to just do "mt fsf N" with a large N to skip to the end, but
  who knows what that would do on some hosts (Ultrix comes to mind).
  
  all-backups and backup-* should be adapted to update the
  last-file-number when they start a tape write operation (this should
  already be maintained actually, just need to ensure that it is
  recorded in the tape database properly at the end of a run).

  Anyway, if "mt status" works, we should get and reset the last file
  number from it, otherwise use the count from the tape database, and
  use that to initialize the file number in all-backups so that the
  backup positions are recorded correctly.

Comments

  This would be particularly useful if we had better end of tape
  handling (e.g. rollover at eot) and with a stacker or jukebox.

  Ideally, all of the backups on a tape should expire at about the
  same time.  Obviously, if we write 5 daily backups to a tape, they
  won't expire at the same time, but that should work out ok - clen-db
  won't free the tape until all of the backups on it are expired.  

  I don't know whether we should force all of the backups on a tape to
  belong to the same chain,level or not.

  Are there any ramifications to having several runs on one tape?
