Amanda-Users

Re: How to examine a tape?

2004-04-22 13:49:11
Subject: Re: How to examine a tape?
From: Eric Siegerman <erics AT telepres DOT com>
To: amanda-users AT amanda DOT org
Date: Thu, 22 Apr 2004 13:42:28 -0400
On Thu, Apr 22, 2004 at 11:01:26AM -0500, brad AT superconnect DOT net wrote:
> Essentially, you just dd the first 4k or so from each "tape file" into a
> uniquely-named file, then skip to the next "tape file" with mt(1).

Then, if the files' format isn't immediately obvious, you can use
the "file" command to (try to) identify them.

Two bug fixes:
> ----- 8< cut here >8 -----
> #!/bin/YOUR_SHELL_HERE
> I=1
> SKIP=0
> $TAPEDEV=/dev/YOUR_NO-REWIND_DEVICE
>
> # optional but sane
> mt -f $TAPEDEV rewind
>
> while true
> do
>
>     # dump 4k from current tape file
>-    dd if=$TAPEDEV of=/tmp/tapefile.$I bs=4k skip=$SKIP
>+    dd if=$TAPEDEV of=/tmp/tapefile.$I bs=4k skip=$SKIP count=1
>
>     # skip to next tape file
>     mt -f $TAPEDEV fsf
>+
>+    # ++I
>+    I=`expr $I + 1`
> done
> ----- 8< cut here >8 -----


> For Amanda tapes, the odd-numbered /tmp/tapefile.N files should be the tape
> labels, the even-numbered ones should be the first 4k from the tar/dump
> archives. I think the archive excerpts are pretty obvious, and amanda tape
> labels have plenty of ASCII data to ponder.

Not sure about that.  IIR, there isn't a tape mark between the
per-file label and the file itself, so /tmp/tapefile.1 will be
the beginning-of-tape label, and the rest of the output files
will each contain the first 4 KB of a per-file label -- you won't
get any content at all.

One could enhance the loop to get some of the content.  Either:
  - increase the amount captured to 40 KB per file; the labels
    are 32 KB, so this would give you, in each /tmp/tapefile.$I
    file but the first, a per-file header plus the first 8 KB of
    data, or
  - do something fancy with two dd commands per pass to produce
    something like you described, with alternating label and
    first-bit-of-content files (but beware of how the per-tape
    label in /tmp/tapefile.1 perturbs the even/odd rule you
    described)

But then, for an Amanda tape, each file's label identifies the
file's format well enough that the first few KB of content won't
likely be very useful.  Either the content is interesting, in
which case you presumably need all of it; or it isn't, in which
case you already knew that from just the label.

> "Press to test."
> (click)
> "Release to detonate."

:-)  For some reason Don Norman comes to mind.

--

|  | /\
|-_|/  >   Eric Siegerman, Toronto, Ont.        erics AT telepres DOT com
|  |  /
It must be said that they would have sounded better if the singer
wouldn't throw his fellow band members to the ground and toss the
drum kit around during songs.
        - Patrick Lenneau

<Prev in Thread] Current Thread [Next in Thread>