0

OS version:

root@triiage_1:~/zip# cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.4 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.4 LTS"
VERSION_ID="18.04"

zip version:

root@triiage_1:~# zip --version
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
This is Zip 3.0 (July 5th 2008), by Info-ZIP.
Currently maintained by E. Gordon.  Please send bug reports to
the authors using the web page at www.info-zip.org; see README for details.

Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip,
as of above date; see http://www.info-zip.org/ for other sites.

Compiled with gcc 6.3.0 20170415 for Unix (Linux ELF).

I have 2 cpio files files

root@triiage_1:~/zip# ll -h;file *
total 111M
drwxr-xr-x  2 root root 4.0K Feb 28 09:12 ./
drwx------ 15 root root  12K Feb 28 09:12 ../
-rw-r--r--  1 root root  56M Feb 28 09:09 kernel1.cpio
-rw-r--r--  1 root root  56M Feb 28 09:09 kernel2.cpio
kernel1.cpio: ASCII cpio archive (SVR4 with no CRC)
kernel2.cpio: ASCII cpio archive (SVR4 with no CRC)

I compress them with zip & split the zip file, 15MB for each split file.

root@triiage_1:~/zip# zip xk.zip -s 15m kernel1.cpio kernel2.cpio
  adding: kernel1.cpio (deflated 1%)
  adding: kernel2.cpio (deflated 1%)
root@triiage_1:~/zip# ll -h
total 220M
drwxr-xr-x  2 root root 4.0K Feb 28 09:23 ./
drwx------ 15 root root  12K Feb 28 09:12 ../
-rw-r--r--  1 root root  56M Feb 28 09:09 kernel1.cpio
-rw-r--r--  1 root root  56M Feb 28 09:09 kernel2.cpio
-rw-r--r--  1 root root  15M Feb 28 09:22 xk.z01
-rw-r--r--  1 root root  15M Feb 28 09:22 xk.z02
-rw-r--r--  1 root root  15M Feb 28 09:22 xk.z03
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z04
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z05
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z06
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z07
-rw-r--r--  1 root root 4.5M Feb 28 09:23 xk.zip
root@triiage_1:~/zip# file *
kernel1.cpio: ASCII cpio archive (SVR4 with no CRC)
kernel2.cpio: ASCII cpio archive (SVR4 with no CRC)
xk.z01:       Zip multi-volume archive data, at least PKZIP v2.50 to extract
xk.z02:       data
xk.z03:       data
xk.z04:       data
xk.z05:       data
xk.z06:       data
xk.z07:       data
xk.zip:       data

Remove original kernel1.cpio kernel2.cpio

root@triiage_1:~/zip# rm kernel1.cpio kernel2.cpio
root@triiage_1:~/zip# ll -h
total 110M
drwxr-xr-x  2 root root 4.0K Feb 28 09:23 ./
drwx------ 15 root root  12K Feb 28 09:12 ../
-rw-r--r--  1 root root  15M Feb 28 09:22 xk.z01
-rw-r--r--  1 root root  15M Feb 28 09:22 xk.z02
-rw-r--r--  1 root root  15M Feb 28 09:22 xk.z03
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z04
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z05
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z06
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z07
-rw-r--r--  1 root root 4.5M Feb 28 09:23 xk.zip

unzip xk.zip with "7z e xk.zip", success.

root@triiage_1:~/zip# 7z e xk.zip

7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,4 CPUs Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz (406E3),ASM,AES-NI)

Scanning the drive for archives:
1 file, 4718352 bytes (4608 KiB)

Extracting archive: xk.zip
--
Path = xk.zip
Type = zip
Physical Size = 4718352
Embedded Stub Size = 4
Total Physical Size = 114818832
Multivolume = +
Volume Index = 7
Volumes = 8

Everything is Ok

Files: 2
Size:       115745324
Compressed: 114818832
root@triiage_1:~/zip# ll -h
total 220M
drwxr-xr-x  2 root root 4.0K Feb 28 09:24 ./
drwx------ 15 root root  12K Feb 28 09:12 ../
-rw-r--r--  1 root root  56M Feb 28 09:09 kernel1.cpio
-rw-r--r--  1 root root  56M Feb 28 09:09 kernel2.cpio
-rw-r--r--  1 root root  15M Feb 28 09:22 xk.z01
-rw-r--r--  1 root root  15M Feb 28 09:22 xk.z02
-rw-r--r--  1 root root  15M Feb 28 09:22 xk.z03
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z04
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z05
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z06
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z07
-rw-r--r--  1 root root 4.5M Feb 28 09:23 xk.zip

Remove kernel1.cpio kernel2.cpio again.

root@triiage_1:~/zip# ll -h
total 110M
drwxr-xr-x  2 root root 4.0K Feb 28 09:37 ./
drwx------ 15 root root  12K Feb 28 09:28 ../
-rw-r--r--  1 root root  15M Feb 28 09:22 xk.z01
-rw-r--r--  1 root root  15M Feb 28 09:22 xk.z02
-rw-r--r--  1 root root  15M Feb 28 09:22 xk.z03
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z04
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z05
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z06
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z07
-rw-r--r--  1 root root 4.5M Feb 28 09:23 xk.zip

Try to combine split zip files xk.zip xk.z01~z07 to a single yk.zip, then unzip it, meet errors.

root@triiage_1:~/zip# zip -s0 xk.zip -O yk.zip
 copying: kernel1.cpio
 copying: kernel2.cpio
root@triiage_1:~/zip# ll -h
total 160M
drwxr-xr-x  2 root root 4.0K Feb 28 09:47 ./
drwx------ 15 root root  12K Feb 28 09:28 ../
-rw-r--r--  1 root root  15M Feb 28 09:22 xk.z01
-rw-r--r--  1 root root  15M Feb 28 09:22 xk.z02
-rw-r--r--  1 root root  15M Feb 28 09:22 xk.z03
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z04
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z05
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z06
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z07
-rw-r--r--  1 root root 4.5M Feb 28 09:23 xk.zip
-rw-r--r--  1 root root  51M Feb 28 09:47 yk.zip
root@triiage_1:~/zip# unzip yk.zip
Archive:  yk.zip
  inflating: kernel1.cpio
  error:  invalid compressed data to inflate
  inflating: kernel2.cpio
  error:  invalid compressed data to inflate
root@triiage_1:~/zip# ll -h
total 211M
drwxr-xr-x  2 root root 4.0K Feb 28 09:47 ./
drwx------ 15 root root  12K Feb 28 09:28 ../
-rw-r--r--  1 root root  31M Feb 28 09:09 kernel1.cpio
-rw-r--r--  1 root root  21M Feb 28 09:09 kernel2.cpio
-rw-r--r--  1 root root  15M Feb 28 09:22 xk.z01
-rw-r--r--  1 root root  15M Feb 28 09:22 xk.z02
-rw-r--r--  1 root root  15M Feb 28 09:22 xk.z03
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z04
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z05
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z06
-rw-r--r--  1 root root  15M Feb 28 09:23 xk.z07
-rw-r--r--  1 root root 4.5M Feb 28 09:23 xk.zip
-rw-r--r--  1 root root  51M Feb 28 09:47 yk.zip

Here is my concerning.

a. the size of kernel1.cpio was changed from 56M to 31M, something seems to be losted.

b. the size of kernel2.cpio was changed from 56M to 21M, something seems to be losted.

c. the total size of split zip files xk.zip xk.z01~z07 is around 110M, why the combined zip file yk.zip is only 51MB?

Am I wrong?

4

1 Answer 1

0

From the personal experiences, 7z does not handle multi-part zip archives in some cases.

unzip does not support multipart archives. zip 3.0 can combine multi-part archives.

Hence, first make single-file archive from the multi-part archives with zip 3.0 as follows:

$ zip -s- xk.zip -O xk_full.zip

using a - sign after the command line option -s without a space joins all the multi-part arachives together and writes it as a single zip file whose file name is designated wit -O option.

-s option is to split into several file, but if size provided is 0 or negative (in our case -), then instead of splitting, join the multi-part archives.

Then, use unzip to decompress the single-file archive we have just created.

$ unzip xk_full.zip

FYI, From the unzip manual:

Multi-part archives are not yet supported, except in conjunction with zip. (All parts must be concatenated together in order, and then zip -F (for zip 2.x) or zip -FF (for zip 3.x) must be performed on the concatenated archive in order to “fix” it. Also, zip 3.0 and later can combine multi-part (split) archives into a combined single-file archive using zip -s- inarchive -O outarchive. See the zip 3 manual page for more information.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.