[HPADM] SUMMARY: Compressed tar archive riddle

From: Jean.Desrosiers@VISAER.com
Date: Tue May 04 2004 - 07:55:53 EDT


Many thanks to those who took time to respond.

 

The lesson here is to not discount the obvious "too simple to work" answer.

 

THE QUERY....

===========================================================================

Is it possible to create a tar tape from a compressed tar archive file, blah.tar.Z, without the need to extract and write the contents of the compressed archive to disk first? I need to duplicate a tape that I made months ago and disk space is an issue. Besides it's so inefficient.....

I've tried a couple of combinations zcat'ing the archive and end up with the files being written to the directory I am in and nothing going to tape.

I firmly believe that someone out there has the elusive one line command that will do it. Maybe something combined with dd?

 

THE ANSWERS...

 

( From Eef Hartman, the answer I put to use. J )

You don't want to put the COMPRESSED image onto the tape?

 

If not:

   zcat filename.tar.Z | dd of=/dev/rmt/0m obs=<blocksize> should put the tarfile onto tape (fill in your own tape device and blocksize), while just pure

   dd if=filename.tar.Z of=/dev/rmt/0m bs=<blocksize>

will put it COMPRESSED onto the tape (you might want to use the non-hardware compression tape device for this, if you got one, like:

crw-r--r-- 2 bin bin 205 0x003000 Jun 4 2001 0hc

crw-r--r-- 2 bin bin 205 0x003080 Dec 20 2002 0hcb

crw-r--r-- 2 bin bin 205 0x003040 Dec 19 16:09 0hcn

crw-r--r-- 2 bin bin 205 0x0030c0 Jun 4 2001 0hcnb

crw-r--r-- 2 bin bin 205 0x003001 May 1 16:26 0m

crw-r--r-- 2 bin bin 205 0x003081 Nov 20 2002 0mb

crw-r--r-- 2 bin bin 205 0x003041 Sep 2 2002 0mn

crw-r--r-- 2 bin bin 205 0x0030c1 Nov 3 2001 0mnb

crw-r--r-- 2 bin bin 205 0x003000 Jun 4 2001 c0t3d0BEST

crw-r--r-- 2 bin bin 205 0x003080 Dec 20 2002 c0t3d0BESTb

crw-r--r-- 2 bin bin 205 0x003040 Dec 19 16:09 c0t3d0BESTn

crw-r--r-- 2 bin bin 205 0x0030c0 Jun 4 2001 c0t3d0BESTnb

(the "BEST" ones are automatic generated, with BEST compression, the 0hc* ones are links TO those, while the 0m* ones are with compression DISABLED, this is for a DDS tape drive on SCSI bus 0, address 3 on a 735). As you can see the bit with value 1 disables compression here (minor).

 

Note that the 0* ones have been generated by ME, are not the default ones.

 

 

Try this:

 

zcat blah.tar.Z > /dev/rmt/0m

( It works but when tabling the resultant tape tar complains about reaching the end of tape and requires user input to continue. J )

 

The slightly fancier version, functionally equivalent unless your tape drive is very picky about blocking factor:

 

zcat blah.tar.Z | dd of=/dev/rmt/0m bs=10240 ( Same as first best working answer J)

 

The block size of 10240 emulates the default blocking factor of "tar".

 

    haven't you tried the 'obvious' ? :

(there's that obvious thing I foolishly discounted in favor of a more complex solution. J )

 

     uncompress < blah.tar.Z | dd of=YOUR_TAPE_DEVICE obs=10k

 

     (or : zcat blah.tar.Z | dd of=YOUR_TAPE_DEVICE obs=10k )

 

    10k is the (age old) 'tar' block-size ...

 

hope this helps,

 

 

If the origional is on tape and the target is an other tape and you have 2

tapedrives, you can do it on the fly. There are 2 basic unix 'trics' involved:

pipelining and the fact that everything can be handled as a file...

 

dd if=/dev/source-tape of=/dev/target-tape

Or from your blah.tar.Z file:

dd if=blah.tar.Z of=/dev/target-tape

 

If the source is compressed and you don't want that on the target, just

uncopmress on the fly.

 

zcat /dev/source-tape | dd of=/dev/target-tape

Or from your blah.tar.Z file:

zcat blah.tar.Z | dd of=/dev/target-tape ( once again, the elegant solution...J )

 

 

J Desrosiers

jean.desrosiers@visaer.com

 


--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)

image001.jpg

This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:40 EDT