why doesn't this untar a tar file to tape device work

why doesn't this untar a tar file to tape device work

Post by Mark Schlegel x3624 11-30 » Sun, 09 Sep 2001 06:06:53



I have a machine on a remote network such that I tarred a
file "file.tar" :

tar cf file.tar directory1 directory2 ... dirN
since I only wanted some of the subdirectories
under there (this machine was HP and had it's
cruddy version of tar that doesn't let you exclude
things so I just explicitly listed the dirs)

and then ftp'ed the file to a local machine.

I want to untar the tar file onto the tape so that the tape is just
like I would have done in on the remote machine, ie.
I don't want to do:

tar cvf /dev/rmt/0mn file.tar

since that would show a user little info if
tar tvf /dev/rmt/0mn was done later.

What I tried was:

tar xvf file.tar - | dd of=/dev/rmt/0m ibs=20b obs=20b

thinking that the - should untar to the stdout and
that dd defaults to stdin as the input.

But upon running this the tape light shows no activity
however the cpu is active doing something and there is
no error msg.

the block size for tar should be 20  512 byte blocks
as stated in the tar man page so I don't see why this doesn't work.
I set dd to use 20b should should mean 20 512 byte blocks since
the 'b' unit is 512

I've verified that /dev/rmt/0mn is the proper device because
mt -f /dev/rmt/0mn offline ejected the tape ok

any ideas?

Mark

 
 
 

why doesn't this untar a tar file to tape device work

Post by Barry Margoli » Sun, 09 Sep 2001 06:34:02




Quote:>What I tried was:

>tar xvf file.tar - | dd of=/dev/rmt/0m ibs=20b obs=20b

>thinking that the - should untar to the stdout and
>that dd defaults to stdin as the input.

No.  When you extract from a tar file, the contents are put back in the
filesystem, using the filenames that are in the tar file.  The '-' argument
is treated by tar as the name of the file in the archive to extract.  Since
there presumably isn't any file in the archive by that name, nothing got
extracted.

The standard output of that tar command will be the messges telling you
what files were extracted.

GNU tar has an option that causes the extracted files to be written to
stdout instead of the filesystem.  However, when this is done, you just get
the file contents, one file right after another.  It's not output in tar
format, so you lose filenames, boundaries between files, attributes, etc.
It's mostly useful if you're extracting just one file, and not if you're
trying to get the archive onto another device.

The solution is much simpler than anything you tried:

dd if=file.tar of=/dev/rmt/0m bs=20b

--

Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

why doesn't this untar a tar file to tape device work

Post by Mark Schlegel x3624 11-30 » Sun, 09 Sep 2001 06:43:53



Quote:> I have a machine on a remote network such that I tarred a
> file "file.tar" :

> tar cf file.tar directory1 directory2 ... dirN
> since I only wanted some of the subdirectories
> under there (this machine was HP and had it's
> cruddy version of tar that doesn't let you exclude
> things so I just explicitly listed the dirs)

> and then ftp'ed the file to a local machine.

> I want to untar the tar file onto the tape so that the tape is just
> like I would have done in on the remote machine, ie.
> I don't want to do:

> tar cvf /dev/rmt/0mn file.tar

> since that would show a user little info if
> tar tvf /dev/rmt/0mn was done later.

> What I tried was:

> tar xvf file.tar - | dd of=/dev/rmt/0m ibs=20b obs=20b

> thinking that the - should untar to the stdout and
> that dd defaults to stdin as the input.

> But upon running this the tape light shows no activity
> however the cpu is active doing something and there is
> no error msg.

> the block size for tar should be 20  512 byte blocks
> as stated in the tar man page so I don't see why this doesn't work.
> I set dd to use 20b should should mean 20 512 byte blocks since
> the 'b' unit is 512

> I've verified that /dev/rmt/0mn is the proper device because
> mt -f /dev/rmt/0mn offline ejected the tape ok

> any ideas?

> Mark

I might as well answer this now that I figued it out :

dd if=file.tar of=/dev/rmt/0m ibs=20b obs=20b

I didn't realize that since it's a tar file, you can just
send it straight in this way.  Then if you look at it later
with     tar tvf /dev/rmt/0m     you see the files inside.

Mark

 
 
 

1. why doesn't 'tar' work?

I've noticed in my RedHat 7.2 install that 'tar' doesn't seem to work.  For
any file  xxxx.tar.gz  when I issue the command

    tar --gunzip --extract xxxx.tar.gz

(or with 'z' replacing '-gunzip', 'x' replacing '-extract'), absolutely
nothing happens.  When I finally stop it with a Ctrl-Z, the prompt comes
back, and then I can kill the stopped tar process.  This behavior is in-
dependent of my being root or user, and occurs both from a cmd line shell
and from MC's cmd line.

Further, if I first unzip the *.gz file using gunzip, then use 'tar':

    tar --extract xxxx.tar

exactly the same thing happens.

OTOH, from MC I can simply press Enter on the *.gz file and see all its
content, and also copy any selection of files to whereever I want.  So ap-
parently 'tar' or its equivalent works for MC, but not for me the way I was
trying to use it.  Anyone have any suggestions as to what I'm doing wrong?

Thx.

- Dushan Mitrovich

2. Enhanced CDs?

3. getting a tar file off a tape when you've tar cf'ed first

4. "Upgrading" password security?

5. Why the patch for console.c in FNT01.tar.Z doesn't work ?

6. BSD and ISDN

7. Multiple Tars on a single tape (doesn't work for meY)

8. xrainbow binaries?

9. How to duplicate tapes when "tar" doesn't work?

10. Why doesn't FreeBSd work with PnP ISA devices?

11. a1.tar - files grow when untar'd

12. tar'ing multiple files and sending to tape device

13. tar -xzvf file.tgz doesn't work anymore.