Operating System - HP-UX
1834157 Members
2364 Online
110064 Solutions
New Discussion

Re: syntax to tar a large file??

 
Kenneth Leung_2
Frequent Advisor

syntax to tar a large file??

what is the syntax to copy / tar a large file to std output & gzip the file from std output to /tmp...? Pls help. Thanks
7 REPLIES 7
Rajeev  Shukla
Honored Contributor

Re: syntax to tar a large file??

If you have GNU version of tar that can do this for uou in just one command

tar -zcvf /tmp/filename.tar.gz $PATH/filename

or else you will have to do it in 2 steps i.e. tar it up and then compress
Bill Hassell
Honored Contributor

Re: syntax to tar a large file??

tar has severe limitations for large files. Standard tar cannot save any file larger than 2Gb. A recent patch made tar capable of saving up to 8Gb but the resultant backup is incompatible with standard tar programs. No files larger than 8Gb can be saved with the HP tar regardless of patches. There is a recent version of the GNU tar program which allows for larger files but like the patchy for 8Gb files, the backup is only compatible with the same version of GNU tar.

To reliably save any file size on HP-UX, you need to use fbackup or a commercial backup program.


Bill Hassell, sysadmin
Kenneth Leung_2
Frequent Advisor

Re: syntax to tar a large file??

That means we cannot make use of the Std input / Std output????
Rajeev  Shukla
Honored Contributor

Re: syntax to tar a large file??

Here is another command to tar and gzip the file at the same time using a single command

tar cf - filename|gzip > /tmp/filename.tar.gz
Bill Hassell
Honored Contributor

Re: syntax to tar a large file??

tar, like virtually all backup programs, writes a header in front of each file. One of the fields is the file size. So if a file exceeds the width of this field, it will be rejected. tar is a relic of early Unix that works for small files that fit on disks that are a few hundred megs. Today, large files require much more sophisticated backup strategies.


Bill Hassell, sysadmin
Peter Nikitka
Honored Contributor

Re: syntax to tar a large file??

Hi,

if you have just one file, why wrap it with tar?
You can gzip it (from stdin) without size restrictions:
cat file | gzip >filename.gz

Note that the following may fail due to size restrictions of gzip itself:
gzip file.gz

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Alexander M. Ermes
Honored Contributor

Re: syntax to tar a large file??

Hi there.
We use the gzip with files larger than 2 GB.
cat file | gzip > file.gz
cat file.gz | gunzip > file
Feel free to test.
Alexander M. Ermes
.. and all these memories are going to vanish like tears in the rain! final words from Rutger Hauer in "Blade Runner"