Amanda-Users

Re: Restore from tape (not using Amanda) syntax

2002-09-25 12:05:39
Subject: Re: Restore from tape (not using Amanda) syntax
From: Anthony Valentine <avalentine AT sbsalaska DOT com>
To: Gordon Cormack <gcormack AT powerserve.com DOT au>
Date: 25 Sep 2002 07:40:46 -0800
Gordon,

You've got several things wrong here.

First, you didn't use mt to forward the tape to the beginning of a tape
file.  After your rewind command, try: 

     mt -f <tapedev> fsf <number>   

where number is the location of the tape file that you want to extract. 
Just for testing, pick 1.


Second, your tar syntax isn't quite right.
  The -c tells tar to create an archive, which is not what you want. 
You want either -x to extract, or -t to list without extracting (good
option to test with).

  The -f switch tells tar what file to create or read (depending on the
previous -c or -x switch).  You need to tell it to read from STDIN which
is done with a '-', like so: 

     'tar -tvf -'

  Also, you don't include a pipe through gzip, which implies that your
tape file is uncompressed.  If you do compress your data (not hardware
compression) then you also need to pipe you command through gzip, like
so: 

     dd if=<tapedev> bs=32k skip=1 | gzip -dc | tar -tvf -

Alternatively, you can use the 'z' switch to GNU tar and it will pipe
through gzip for you: 

     dd if=<tapedev> bs=32k skip=1 | tar -tvzf -        


To make all of this easy, you can read the header at the beginning of
each tape file, and it will tell you the command to extract:
     mt -f <tapedev> rewind
     mt -f <tapedev> fsf 1
     dd if=<tapedev> bs=32k count=1

Be sure to rewind the tape again after you do that.



Good luck!

Anthony Valentine


On Wed, 2002-09-25 at 03:38, 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?
> 
> Thanks,
> Gordon.
-- 
UNIX was not designed to stop you from doing stupid things, 
because that would also stop you from doing clever things.