I have a folder of roughly 600MB of images in a folder output_test
. I then create 100MB chunks of tar.gz files using the following command:
tar -czf - output_test/ | split --bytes=100MB -d -a 3 - output_test.tar.gz.
which gives me the following files
-rw-rw-r-- 1 martin 96M Nov 13 17:12 output_test.tar.gz.000
-rw-rw-r-- 1 martin 96M Nov 13 17:12 output_test.tar.gz.001
-rw-rw-r-- 1 martin 96M Nov 13 17:12 output_test.tar.gz.002
-rw-rw-r-- 1 martin 96M Nov 13 17:12 output_test.tar.gz.003
-rw-rw-r-- 1 martin 96M Nov 13 17:12 output_test.tar.gz.004
-rw-rw-r-- 1 martin 96M Nov 13 17:12 output_test.tar.gz.005
-rw-rw-r-- 1 martin 26M Nov 13 17:12 output_test.tar.gz.006
Looks all good (although it seems total size hasn't been reduced?), but then when I try to un-tar one of the files
tar -xzf output_test.tar.gz.000
I get the following error
gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
Does anyone know why this error happens?
Though it seems like the files are extracted fine. So, I'm not sure if I can safely ignore this error?
.000
archive is probably (almost certainly) split across.000
and.001
so you're not extracting it. You'll probably get an error if you try to extract from.001
since its header is not that of a zip archive. You need tocat
all of the files together and pipe that to tar. The archive is not much smaller since most image formats are already compressed. Trying to compress them again might actually increase the file size.