How to split a gzip file to chunks of a pre-determined size that are valid gzip files themselves?
Something like split -b 4095M example.img.gz would not work given that it would cut through the internal structure of the gzip file. My goal is for the gzip chunks to be re-asssemble-able from multiple devices, so each gzip part file has to be valid on its own.
The gzip file
itself should be of a predetermined size, not the content it expands to.
For re-assembling, the following is useless because it requires all the files to be available at the same time, making it useless for splitting across devices:
Code:
cat example.img.gz.part* |gzip -d -c >> exaple.img
What I want is this:
Code:
gzip -d -c example.img.part*.gz >> example.img
I want each part of the gzip to be a valid gzip file of its own, so they can be assembled from multiple devices.
The pre-determined size doesn't have to be exact, but within a few megabytes of a desired value. For example, if I want 4096 MiB chunks, something like 4090 MiB is acceptable too.
This is already possible with bzip2 by "abusing" bzip2recover. Normally, bzip2recover was intended for merging undamaged parts of copies of damaged archives, but it can be used to break down any bzip2 into one file per bzip2 block. This way, multiple blocks can be concatenated into parts of any desired approximate size.
The reason I prefer gzip for this purpose is its much faster speed.