Operating System - HP-UX
1819519 Members
2875 Online
109603 Solutions
New Discussion юеВ

Re: Splitting and merging large size 'tar' files

 
SOLVED
Go to solution
manoj_pu
Regular Advisor

Splitting and merging large size 'tar' files


Hi

Can anybody please tell me the best option for splitting and merging large size tar files?

I have a tar file of 1GB size. I need to split that file into two or three part of small size and merge it back to original.

What is the best option to do this in hp-ux os?


Regards
Manoj
Leave with out tense and try best you gets result
11 REPLIES 11
Peter Godron
Honored Contributor

Re: Splitting and merging large size 'tar' files

Manoj,
have never tried it with tar files, but have a look at the split command.
As a side line, why do you have to split the file?
manoj_pu
Regular Advisor

Re: Splitting and merging large size 'tar' files

Hi Peter,

I have used the split command and splitted 1GB tar file into two parts of 500MB.

But I am not able to merge it back to original tar file using 'merge' command.

I am unable to transfer 1GB file thru network, so I want to split this file into small size and transfer.
Leave with out tense and try best you gets result
Peter Godron
Honored Contributor
Solution

Re: Splitting and merging large size 'tar' files

Manoj,
you would not use merge to join the files back together.

I would try
cat part1 > whole_file
cat part2 >> whole_file
Hemmetter
Esteemed Contributor

Re: Splitting and merging large size 'tar' files

Hi Manoj

You can simplt do

cat xa* > original.tar

Rgds
HGH
Arunvijai_4
Honored Contributor

Re: Splitting and merging large size 'tar' files

Hi Manoj,

What error you are getting when trying to merge ? Also, few things you can try

1) http://www.chami.com/Tips/internet/110896I.html

2) gzip -9 which gives the best compression ratio. You canb try to .gz the files and send it across.


-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Hemmetter
Esteemed Contributor

Re: Splitting and merging large size 'tar' files

hi again Manoj

You can even do

cat part* | tar xvf -

to unpack without physically merging.

rgds
HGH
Robert-Jan Goossens
Honored Contributor

Re: Splitting and merging large size 'tar' files

Hi,

# split -b 10m HWE1100.depot
# ls
xaa xad xag
xab xae xah
xac xaf xai
# cat xaa xab xac xad xae xaf xag xah xai > HWE1100.depot.tar

Regards,
Robert-Jan
manoj_pu
Regular Advisor

Re: Splitting and merging large size 'tar' files

Hi,
I have tried with all options I have received. Seems all are working.
I could view and extract the content of original tar file.

However tar command comes out with expected (proper)output as well as below error message.

Tar: error! blocksize changed

What does this message indicates?

Thanks & regards

Manoj


Leave with out tense and try best you gets result
Arunvijai_4
Honored Contributor

Re: Splitting and merging large size 'tar' files

Hi Manoj,

Check this thread out,

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=190047
[Tar: error! blocksize changed]

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Peter Godron
Honored Contributor

Re: Splitting and merging large size 'tar' files

Arun,
if the tarfile is 1Gb in size, how can it be a >2Gb file issue?
Sandman!
Honored Contributor

Re: Splitting and merging large size 'tar' files

Hi Manoj,

The tar error regarding blocksize changed comes from the fact that you are trying to unpack the contents of the tar file in a dir which doesn't have enough space left to accomodate the unpacked files. Solution would be to either unpack it to a mount point large enough or to extend the current one, though the former option would be the fastest one.

cheers!