Tar command Solaris version for files larger than 2 GB

archivesolaristarunix

We have several files larger than 2GB tared using tar command UNIX version (SunOS 5.5 with last change: 1995!). There is "E" flag to tar files > 2GB. This is how it was been done:

rsh sun_server tar cvEf - abc/file1 abc/file2 | rsh archive_server archive_cmd

Notice that archive_server is also a UNIX server and uses the same version of tar command.

In retrieving, we do so:

cd /destination_path/
rsh archive_server retrieve_cmd | tar xvf - 

What happened is the files are extracted to /abc/ (in parent directory); not in /destination_path/abc/

The strange thing is we changed the retrieving method to gtar:

cd /destination_path/
rsh archive_server retrieve_cmd | gtar xvf - 

For files > 2GB, it gives many errors of "bad header" and "memory exhausted" error at the end.
However, for files that are less than 2GB, they are extracted normally to /destination_path/abc/ !

We need to extract the >2GB files to /destination_path/abc/ because there are many files under /abc/ have the same names and we afraid that the extracted files would overwrite them..

I also tried

rsh archive_server retrieve_cmd | tar xvf - /destination_path/

and

cd /destination_path/
rsh archive_server retrieve_cmd | tar xvf - .

But the result is: no result! It shows that the extraction is completed successfully but no files extracted neither in /abc/ nor in /destination_path/ !

Is there a way to extract these files to the desired destination path..?

Best Answer

rsh is faster than ssh, but I prefer ssh. this should work substituting ssh with rsh.

gtar -cf - files | ssh user@host "(cd /destPath ; gtar -xf -)"

The key here is enclosing in parenthesis.

Related Topic