View Full Version : split tar file into two (or more) files
petern
10-18-2005, 09:57 AM
Hi all good helpers.
I have created a packed tar file .tgz, but its total size becomes very large and difficult to handle (the data I have stored is very large...).
Is there a way to split a .tgz file into many (and of course: is there then an easy way to concatenate them again...)
/ Peter
hayne
10-18-2005, 10:10 AM
You could of course just create several different tar files, each with a subset of the files.
But if you want to keep with the one tar file approach, you could split it up into pieces by using /usr/bin/split (with the "-b" option) - read 'man split'.
And then to rejoin them into one big file again, you could use /bin/cat
petern
10-18-2005, 10:12 AM
thanks, that's exactly what I needed!
acme.mail.order
10-18-2005, 08:19 PM
Unless you must have a unix-only solution look at hdiutil - make a segmented disk image. Very desktop-friendly, the files are separate but it behaves as a single image.
LizardtheFish
11-28-2006, 07:22 PM
More info for beginners. I accomplished the above process successfully with these commands:
tar'ed the file with:
nohup nice tar -cf /foo.bu.tar /fooSource &
split the file into 500MB chunks with:
nohup nice split --line-bytes=500m foo.tar.gz foo_ &
rejoined the file with:
nohup nice cat foo_a* > foo_FULL.tar.gz &
hope it works for you too...
BTW, the nohup, nice and '&' are just for running the contained command considerately in the background of my terminal window because the processes took so long.
Lizard
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.