Possible to combine several bz2 archives into one?

dmn picture dmn · Aug 4, 2011 · Viewed 9.3k times · Source

I have several (27) huge (several GB each) bz2 archive files that I need combined into one bz2 archive. Uncompressing them and then creating a new archive from what was just uncompressed is not an option for me, since compressed, all 27 files add up to about 100GB, and uncompressed it's about 5-6TB (yes that's TERAbytes lol).

Can this be done with some sort of script, or is there even another compression format that allows for this to be done (easier)?

Answer

Mikołaj Izdebski picture Mikołaj Izdebski · Nov 1, 2011

You can simply concatenate many bz2 files into single bz2 file, like that:

$ cat file1.bz2 file2.bz2 file3.bz2 >resulting_file.bz2

bzip2 and other utilities like lbzip2 will be able to decompress the resulting file as expected.