Operating System - HP-UX
1828215 Members
2098 Online
109975 Solutions
New Discussion

creating compressed data and archive into tape

 
S.C. Fun
Advisor

creating compressed data and archive into tape

Hi, I have 2 questions:
1. How to create .tar.gz files so that I could put into the web for distribution? I would expect the user to use the command
gzip -dc [file name]| tar -xvf -
to extract it.

2. How to compress directory or files, and straight away archive it into the tape using
a. fbackup
b. tar ?
Thank u and bye.
10 REPLIES 10
Robin Wakefield
Honored Contributor

Re: creating compressed data and archive into tape

Hi,

To create your gzip file:

# cd dir
# tar cf - ./* | gzip - > filename.tar.gz

To uncompress
# cd another_dir
# gunzip -c filename.tar | tar xf -

For your tape backups, can you not use device compression? Have you a specific example?

Rgds, Robin.

S.C. Fun
Advisor

Re: creating compressed data and archive into tape

The device file I mentioned in the 2nd question could be /dev/rmt/0m . Can I gzip / compress a directory, or files, then fbackup or tar into this tape directly?
Thank u.
Volker Borowski
Honored Contributor

Re: creating compressed data and archive into tape

Hi SC,

if you want to distrubute, be sure to use relative pathnames in tar-command.
(Something you should make sure whenever you extract something-> tar -tvf ...... and check for absolute stuff like /vmunix esp. if added to the end of an tar-archive)

if you want to archive everything in the current directory, you should do as suggested,
beside I tend to use

tar -cvf - .

because

tar -cvf - ./*

will not select all hidden files in the current directory like .profile, .netrc or so.

Hope this helps
Volker
Eugen Cocalea
Respected Contributor

Re: creating compressed data and archive into tape

Hi,

1.

cd
tar -cvf - .|gzip - >file.tar.gz

2.

cd
gzip -rv * |tar -cv /dev/

E.
To Live Is To Learn
Carlos Fernandez Riera
Honored Contributor

Re: creating compressed data and archive into tape

Tape device will compress data for you by default.
unsupported
S.C. Fun
Advisor

Re: creating compressed data and archive into tape

Eugen, the 2nd method u suggest seems not working.

Carlos, if we use hardware compression, such as /dev/rmt/c0t4d0BEST, could we control the compression rate? How we know how many percent of data could be compressed at the end of archiving the data?

For e.g., I have 7GB to backup, my tape supports 4GB without compression, 8GB after compression. Could we rest assure that we could backup the data using compress mode?

Thank u.
Eugen Cocalea
Respected Contributor

Re: creating compressed data and archive into tape

Hi,

Hardware compress you can trust :) If they say 8 GB of data it doesn't mean that they will compress your 7GB to fit in 4GB but that they will put 7GB on that tape.

Btw, what's not working on the 2nd example? (that was a solution to soft-compress then archive).

E.
To Live Is To Learn
Volker Borowski
Honored Contributor

Re: creating compressed data and archive into tape

Sorry to contradict,

you will not manage to write 7 GB of zip-files to 4GB Tape with an "estimated" hardwarecompression of 8GB.
The average estimate is 2:1 as this makes sense for an average mixture of binaries (1:1,5) and textfiles (1:4 or better).

Hardware compression has the problem, it has to compress a datastream, so it can not calculate an optimal compression. Usally hardware compression uses Huffman or comparable strategie.
GZIP can calculate an optimal compression code, this is why it is slower than i.e. "compress".
Now the real problem is, that if you pipe compressed data through a Huffman-compress (on the tape) the result will even be bigger than the input !
So if you backup GZIP-files, you should use a NO-compress devicefile !

Hope this helps
Volker
Santosh Nair_1
Honored Contributor

Re: creating compressed data and archive into tape

Volker is correct, you can't always assume that hardware compression will give you 2:1. It depends entirely on the data that you're dumping. Compressed files, i.e. .gz and .Z files, usually get no compression or worse yet, get negative compression because of overhead when you try to re-compress them on tape.

-Santosh
Life is what's happening while you're busy making other plans
Carlos Fernandez Riera
Honored Contributor

Re: creating compressed data and archive into tape

I erased reference to no compresion device in my last response. See man mksf to see how to do it.


I think the best for this 7GB is to write it directly to tape. Using pipes reduce to compress can result i a lower transfer rate which affects to tape performance and capacity.

___

For information: DDS's use Lempel-Ziv compression algorithm. DCLZ (Data compresion Lempel Ziv).
unsupported