tar and gzip problem

Hi Guys,

I have a few files. i want to tar these files and zip it using gzip it.

-rw-r-----   1 magesh  magesh    12940369 Jul 27 09:26 dcx_imds_c.asc
-rw-r-----   1 magesh  magesh     1221391 Jul 27 09:27 dcx_imds_h.asc
-rw-r-----   1 magesh  magesh     1105673 Jul 27 09:27 dcx_imds_mc.asc
-rw-r-----   1 magesh  magesh    10676635 Jul 27 09:27 dcx_imds_m.asc
-rw-r-----   1 magesh  magesh      967019 Jul 27 09:27 dcx_imds_mi.asc
-rw-r-----   1 magesh  magesh    25975881 Jul 27 09:27 dcx_imds_ml.asc
-rw-r-----   1 magesh  magesh     8466649 Jul 27 09:27 dcx_imds_mn.asc
-rw-r-----   1 magesh  magesh     3007118 Jul 27 09:27 dcx_imds_r.asc
-rw-r-----   1 magesh  magesh    22433288 Jul 27 09:27 dcx_imds_ra.asc
-rw-r-----   1 magesh  magesh   491930039 Jul 27 09:27 dcx_imds_rp.asc
-rw-r-----   1 magesh  magesh    76974343 Jul 27 09:27 dcx_imds_rw.asc
-rw-r-----   1 magesh  magesh    25062622 Jul 27 09:27 dcx_imds_s.asc
-rw-r-----   1 magesh  magesh    50828494 Jul 27 09:27 dcx_imds_ss.asc
-rw-r--r--   1 magesh  magesh   312270848 Jul 27 09:36 07272009.tar

As you can see i can tar all the files. But when i gave the gzip command, i am getting an error in it. The following is the command and its error.

acidmmm:gzip 07272009.tar

gzip: 07272009.tar.gz: No space left on device

Is there any limit on size of the file.. If so, Please advise me on how to take it forward. I just want to archive these files in as much less memory i can.

Thanks for your help in advance,

Regards,
Magesh

try running below command and see if any of the file systems is 100%
$df -k .

Hi.

You can tar and gzip files at the same time:

i.e.

tar cvf - * | gzip -9 > myfile.tar.gz

This saves you the space of the tar file as it's is never actually created.

Hi Scotn,

Thanks for your reply.. can i what is the use of "-" in the tar part and "-9" in gzip part..

I like to understand the command you have given.

Hi.

The - in tar means (with the c option) write to standard output (or read from standard input with the x option).

The -9 means maximum compression (9) (you can use -c also, which means read from standard input with gzip, and write to standard output with gunzip, but it seems most gzips are happy without it)

It's all explained in the man pages.

----
Sorry I didn't explain it very well (or at all!).

tar cvf - files_or_directories

Will tar up the files or directories you specify and write the tarfile to standard output.

 | gzip -9

will pipe the output (the tar file) into gzip and compress it (using maximum compression, -9) and write this to standard output (as it doesn't have either an input or output filename to work with)

 > myfile.tar.gz

will direct standard output (your compressed tar archive) to myfile.tar.gz.

You can do the reverse also:

gunzip -c myfile.tar.gz | tar xvf -

This is quicker and saves diskspace in the short term. You can do similar things with pipes, such as when exporting large database schemas directly to compressed files, etc, if you don't have enough space for the .dmp file.

In fact, you can set up just about anything to write directly to a compressed file.

i.e.

mknod myLogFile.txt p
cat myLogFile.txt | gzip -9 > myLogFile.txt.gz &

(run your program or script that writes to myLogFile.txt)

The background process "cat .... &" will end when your program or script does

sorry for the late reply.. but thanks to your explanation...

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