1833187 Members
2950 Online
110051 Solutions
New Discussion

compression

 
SOLVED
Go to solution
Fadia Almarei
Super Advisor

compression

Dear All

i do my tar backup on hard disk hich i 36GB, and i do te ackup for two files the bigger one is 30GB , and then when i do compress command on the file the disk become full before it finished compressing .
is there is any thing (patch) can i add to the tar command to compression and tar at the same time ???
BR,
Fadia
fadia.marei
22 REPLIES 22
Naveej.K.A
Honored Contributor

Re: compression

hi fadia,

tar doesnt support files more than 2GB.
Look out for GNU TAR

regds
Naveej
practice makes a man perfect!!!
Fadia Almarei
Super Advisor

Re: compression

i know that , i do the tar for a folder which contain many files ,the size of all of these files less than 2GB , the tar file result from this is almost 30GB size , so i want to use the tar command with option to compress the files at the same time
fadia.marei
Naveej.K.A
Honored Contributor

Re: compression

hi fadia,

GNU TAR will do it for you.

get it from
http://hpux.connect.org.uk/hppd/hpux/Gnu/tar-1.14/
and install it

with best wishes
Naveej
practice makes a man perfect!!!
Mark Grant
Honored Contributor
Solution

Re: compression

You can do it in memory with something like

tar cf - | gzip > newfile.tgz

However, I'm not sure how much RAM you are going to use with these files of yours.
Never preceed any demonstration with anything more predictive than "watch this"
Fadia Almarei
Super Advisor

Re: compression

Dear Mark
i try this but it gives me error that gzip not found.but i want to know is the file i put for gzip is a new file , if this is the case , i will hae a problem that i will have wo files one is from the tar and the other from the gzip. is is rigth or what
fadia.marei
Shaikh Imran
Honored Contributor

Re: compression

Hi,
Do you have enough space on the disk/filesystem where you are compressing the file ?
Normally compressing a file requires atleast 50%-100% of the free space on disk/filesystem
depending upon the ratio of compression.

Regards,


I'll sleep when i am dead.
Fadia Almarei
Super Advisor

Re: compression

as i said the file disk i have is a free disk with 36GB , but when i do the tar for the first folder (which contain many files) the resulted tar file is 30GB.
fadia.marei
Stuart Browne
Honored Contributor

Re: compression

The command Mark gave you would be the best one to use if 'gzip' is in your path.

If it's not, use the full path for 'gzip'.

If you don't have gzip (I find this very hard to believe), try using 'compress' in it's stead:

tar cf - | compress > newfile.tar.Z

The whole point of this (to make it a bit clearer) is to do the commands in a pipe. This means you aren't creating a 30GB intermediate file before you compress it, it's done as-you-go.

Your current issue is that your 36GB disk has 30GB used already for your 'tar' file, which means your compression doesn't have any worknig space to play with (depending on the compression program you use dpeends on how much space you need).

Pipes are good. Use them.
One long-haired git at your service...
Franky_1
Respected Contributor

Re: compression

Hi Fadia,

you could use

tar cfv - | gzip -9 >

This should tar and compress the files in one step

HTH

Franky
Don't worry be happy
Sanjay Kumar Suri
Honored Contributor

Re: compression

There is no option in tar which does compression and backup simultaneously.

As previous post suggest, use the -z option in gzip to compress the backup.

sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
Michael Tully
Honored Contributor

Re: compression

You should be able to use gzip found in /usr/contrib/bin
Failing that you can download it from here. The usage of tar with the pipe through gzip is a very good method.

http://hpux.connect.org.uk/hppd/hpux/Gnu/gzip-1.3.5/
Anyone for a Mutiny ?
Fadia Almarei
Super Advisor

Re: compression

Dear Sturt
just a small question when using this tar command
tar cf - | gzip > newfile.tgz
the files used is the files that i will do backup for or at which i will do the backup ,
and also as i have to do the backup for a directory contains many files can i replace it with the dirctory path
fadia.marei
Franky_1
Respected Contributor

Re: compression

Hi Fadia,

look at my reply and you'll see that you can do it with the directory.
Btw, would you mind assining points ?

Regards

Franky
Don't worry be happy
Fadia Almarei
Super Advisor

Re: compression

put i want to do the backup on disk , does any thing change ,and the question was is this the file that i want to do backup for or at
fadia.marei
Franky_1
Respected Contributor

Re: compression

Hi Fadia,

the files respectively the directory named after the tar command are / is the thing you want to backup
For example if you want to backup /tmp
then : tar cfv - /tmp|gzip ...

HTH

Franky
Don't worry be happy
Fadia Almarei
Super Advisor

Re: compression

Frank
i tried it but it does not work, what shull i do for that
fadia.marei
Patrick Wallek
Honored Contributor

Re: compression

What exactly did you try? What error message are you getting? How is it not working? Please show the exact command you are trying.
Fadia Almarei
Super Advisor

Re: compression

i do the backup for the directory without writing the file name at which tar cvf for and the error message is
"tar: usage tar [-]{txruc}[eONvVwAfblhm{op}][0-7[lmh]] [tapefile] [blocksize] [[
-C directory] file] ..."


the command i use is
" tar cvf /u01/oracle/oa11idata|/usr/contrib/bin/gzip > /u04/SAT-u01.tgz"
fadia.marei
Mark Grant
Honored Contributor

Re: compression

You are missing the "-" character. Try

tar cvf - /u01/oracle/oa11idata|/usr/contrib/bin/gzip > /u04/SAT-u01.tgz
Never preceed any demonstration with anything more predictive than "watch this"
Fadia Almarei
Super Advisor

Re: compression

thanks ALL ,
but i want to ask if i want to restore my data agian , can i do it by uncompress the file first and then do the tar command or there is another way
fadia.marei
Sanjay Kumar Suri
Honored Contributor

Re: compression

I tried the following and got some surprises:

-rw-rw-r-- 1 sks xyz 294 Apr 21 11:28 data

$tar cvf- data.tar data;gzip data.tar
-rw-r--r-- 1 sks xyz 322 Jun 27 13:55 data.tar.gz

No issue to recover data after gunzip & tar -xvf.


$tar cvf- data.tar data|gzip > data.tar.gz

-rw-r--r-- 1 sks xyz 20 Jun 27 14:02 data.tar.gz

$gunzip data.tar.gz

-rw-r--r-- 1 sks xyz 0 Jun 27 14:07 data.tar

So using tar > gzip lead to a file which is 0 bytes whereas tar;gzip leads to correct results.

Any explanation?


sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
Stuart Browne
Honored Contributor

Re: compression

You can do the same sort of command in reverse.

As Sanjay says, you can un-gzip separately, or you can do it in a pipe like you made the backup.

You did:

tar cvf - /u01/oracle/oa11idata|/usr/contrib/bin/gzip > /u04/SAT-u01.tgz

To restore this, you'd do:

cd /;gunzip -c /u04/SAT-u01.tgz | tar xvf -

This will un-compress to the STDOUT (rather than to an on-disk file), and throw the information via the pipe into tar to extract it. (If you don't have the 'gunzip' sybolic ilnk or binary, you can use 'gzip -cd' instead. They do the same thing).

As you've got the full-root-oriented-path in the backup line, it will over-write the existing data. You might want to consider using a relative path in future:

cd /u01/oracle;tar cvf - ./oa11idata | /usr/contrib/bin/gzip > /u04/SAT-u01.tgz

This would allow you to restore to a different path other purposes
One long-haired git at your service...