Uncompressing a multi-part 7zip file in Debian
7zip is a popular compression program for Windows. It allows to effectively compress files, split them into several archives and to add protection by using a password. This all works fine if you are a Windows user. In case you now want to extract such a multi part password protected file in Linux, you’ll find out that this isn’t a standard use case. Uncompressing these files involves some work. 7zip is not made available for Linux by the developer. Gzip or zip won’t work with 7zip compressed files. But: an unofficial version is available and it is possible to extract 7zip files in Debian/Linux.
You have some options available for installing 7zip for Debian, like apt or by compilation. The version you get with apt is quite old: 9.2. In case the version of 7zip used to compress the file on Windows is higher than the one available for Debian, uncompressing may not work. An algorithm may be used that is not available on the lower version. In that case, 7zr will exit with an error and showing Unsupported Method.
Compilation from source
This option will give you the latest available version of 7zip for Linux. Especially useful when you try to unzip a file and get the message: Unsupported Method. To solve this, try to install a higher version of p7zip by downloading the source and compile p7zip.
Get the latest version of p7zip from SourceForge. Unzip it and then run make. After the compilation is done, you’ll have the executable 7za in the bin folder. This version should be able to work with files compressed by 7zip for Windows. Make sure to read the README.
Copy the correct makefile. 7zip provides several makefiles, for each target platform / architecture. In case of Linux, the default one should work. To start compilation, a simple make is sufficient.
make
This gives you the binary ./bin/7za
Unzip a file multi-part password protected file.
7za x h1.7z
APT
Install the 7zip program for Debian. This installs version 9.2.
sudo apt-get install p7zip
Let’s say we have 1 file that was zipped to file h1.7z using 7zip and splitter into 650 MB. 7zip produces 2 archives:
- h1.7z.001
- h1.7z.002
To list the archive:
7zr l h1.7z.001 -tsplit
We can see that the split archives contain one file named h1.7z. That is the zip file created by 7zip under Windows.
To unzip the file, use
7zr x h1.7z.001 -tsplit
2 Comments
Pedro Duarte · November 6, 2018 at 13:11
Hi
You answer is the closest I have to my problem. I want to split an mp4 video into 40Mb parts, in a windows server, and then download the parts into a debian machine, and unzip them into the the original mp4 file. I haven’t managed be it with winrar, zip or 7pzip.
I can split the video.mp4 into parts video.7z.001,…,video.7z.005 (for example), but applying your suggestion I end up with a video.7z file which I do not manage to unzip into the video.mp4 file.
1- create in windows with 7-zip 18.05 (x64) video.7z.001,..,video.7z.005
2- installed 7-Zip (a) [32] 16.02 in Debian
3- Download them into debian machine (first with python requests but now Im using curl from python)
3- In debian machine, 7zr x video.7z.001 -tsplit
4- End up with video.7z but unable to decompress it to video.mp4
Did I misunderstood your suggestion or am I doing something wrong?
Thanks
Tobias Hofmann · November 6, 2018 at 16:30
Hi Pedro,
maybe the Debian version cannot understand the algorithm used by the Windows 7zip? Have you tried the first option, installing 7zip from source? Then 7za x video.7z?