Amanda-Users

Re: Restore from tape (not using Amanda) syntax

2002-09-25 10:22:10
Subject: Re: Restore from tape (not using Amanda) syntax
From: Jon LaBadie <jon AT jgcomp DOT com>
To: amanda-users AT amanda DOT org
Date: Wed, 25 Sep 2002 10:00:22 -0400
On Wed, Sep 25, 2002 at 09:38:55PM +1000, Gordon Cormack wrote:
> Hi Peoples,
> 
> I'm trying to dump from an Amanda tape onto the hard-drive by not using
> Amanda. This is probably a "you don't know how to use tar properly" question
> but:
> 
>       #mt -f /dev/rmt/0n status
>       Vendor 'SONY    ' Product 'SDX-300C       ' tape drive:
>       sense key(0x6)= Unit Attention   residual= 0   retries= 0
>       file no= 0   block no= 0
> 
>       #mt -f /dev/rmt/0n rewind
> 
> I'm obviously doing something wrong here cause the command:
>       #dd if=/dev/rmt/0n bs=32k skip=1 | /usr/local/bin/tar -cv -f
> /export/output.tar
>       /usr/local/bin/tar: Cowardly refusing to create an empty archive
> 
> The tape only has about 2GB of compressed data on it so it's not huge...
> 
> Any ideas?

You haven't read/understood the layout of an amanda tape.

An amanda tape consists of separate "tape files", administrative ones at
the start and end of the tape, and individual "tape files" for the dump
of each disk list entry.

When you amlabel a tape, the first file is laid down identifying the tape.

Guess how amanda knows what tape it is, it reads the first file.

When you rewind and take the first data from the tape, you are trying to
"untar", the amanda label, not a dump.  Guess how big that file is, 32KB.
Just the size you skipped.  Thus tar's input is "empty", just as it says.

You have to position the tape (using mt) at the beginning of a dump file.

Other considerations:
- why are you trying to "create" a tar archive (-c option)?  don't you
  already have a tar archive on the tape that you want to extract?
- did you use hardware or software compression?  if the latter, you
  need a gzip -dc in that pipeline.
- the first 32KB of each dump file (the header you are trying to skip over)
  contains a pretty close approximation of the command line you need to
  extract that dump file.  To read the header, position the tape with mt and
  use your dd command without tar, changing skip to count.
  
-- 
Jon H. LaBadie                  jon AT jgcomp DOT com
 JG Computing
 4455 Province Line Road        (609) 252-0159
 Princeton, NJ  08540-4322      (609) 683-7220 (fax)