Re: How to examine a tape?

2004-04-22 Thread brad
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).

I've had good luck with something like the following (sorry, don't have
source handy right here):
- 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

# skip to next tape file
mt -f $TAPEDEV fsf
done
- 8 cut here 8 -

You probably want to figure out how to terminate the loop for your own
setup. I remember examining exit status from the mt(1) fsf command to figure
out end-of-tape, but I also managed to Ctrl-C out when the console was all
errors.

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.
--
Brad Morrison, [EMAIL PROTECTED]
Press to test.
(click)
Release to detonate.



Re: How to examine a tape?

2004-04-22 Thread Eric Siegerman
On Thu, Apr 22, 2004 at 11:01:26AM -0500, [EMAIL PROTECTED] 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.[EMAIL PROTECTED]
|  |  /
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


Re: How to examine a tape?

2004-04-22 Thread Jon LaBadie
On Wed, Apr 21, 2004 at 01:07:18PM +0200, Mats Blomstrand wrote:
 Hi All
 
 I have been given a tape with useful data on. I dont know how the data is
 put on the tape so cant figure out how to get to it. I have tried to use tar
 to read directly from tape-device but it doesnt recognize anything.
 
 Please enlight me with some tape-basics on how to investigate an unknown tape.


Solaris has a tcopy command.  Do other OS's??

One use of tcopy is to examine the number and organization of
files on the tape.  For each tape file it prints out information
about the size of the blocks and the number of blks of that size.

-- 
Jon H. LaBadie  [EMAIL PROTECTED]
 JG Computing
 4455 Province Line Road(609) 252-0159
 Princeton, NJ  08540-4322  (609) 683-7220 (fax)


Re: How to examine a tape?

2004-04-21 Thread Nicolas Ecarnot
Mats Blomstrand wrote:

Hi All

I have been given a tape with useful data on. I dont know how the data is
put on the tape so cant figure out how to get to it. I have tried to use tar
to read directly from tape-device but it doesnt recognize anything.
Please enlight me with some tape-basics on how to investigate an unknown tape.
Thanks!
//Mats
[Part of a doc I wrote in french, but you'll understand the commands :]

dd if=/dev/nsa0.1 of=/tmp/restored/monFichierArchive bs=32k skip=1

L'option skip=1 est utilisée ici pour éviter de lire l'entête du 
fichier d'archive, qui n'en fait pas partie, mais qui est rajoutée par 
Amanda.

On peut ensuite exploiter (en extraire des fichiers) le fichier 
d'archive avec les commandes tar ou restore (selon la méthode 
utilisée lors de la sauvegarde) :

[EMAIL PROTECTED] # tar tvf /tmp/restored/monFichierArchive

ou

[EMAIL PROTECTED] # restore -tvf /tmp/restored/monFichierArchive

I know, I'd rather translate this huge doc in english...

--
Nicolas Ecarnot