I have a rather large (~500GB) 7-zip archive. I originally made it when I had more space available, and did so at rather fast, low-compression settings.

Now things are tight, and I'd like to try and compress it down even more. However, I lack the free space to decompress and recompress it. (That's kinda the problem to begin with).

Is there any way I can recompress it inline? Of course, I could easily do this with a .tgz archive on Linux using streams, and I'm hoping there's something similar.

I'm using 7z because I'm normally on Windows, but I can use either Linux or Windows for this specific job.

  • Even if you were to recompress it without storing the uncompressed data anywhere, you’d still need space for both the current archive and the recompressed archive. – Daniel B Sep 8 '15 at 16:57

Depending on the similarities of your files, one option would be to compress the archive a second time, known as double compression. This in theory combines all of the files in your archive with the other files in your archive, thus making it an extremely compressed file. The benefits will vary as to what type of files you're using though. One problem you might have is not enough space to compress your compressed files, though it's worth a shot to at least see what the estimated end result will be.

  • 2
    No, that won’t work. Compressing raises entropy so much, compressing it again will most likely make the file even larger. – Daniel B Sep 8 '15 at 16:28
  • I think you've misunderstood me. I'm not saying just take a single file, compress it, and then compress it again. The majority of the time this will make the file larger. I'm talking about taking multiple files, compressing them into a file, and compressing that file. The second compression combines all of the original files together to make them even smaller. As I mentioned it varies as to what file type you're using to how much of a benefit you'll gain, but in some cases it can make files extremely small. – Bugattikid2012 Sep 8 '15 at 16:29
  • No, I think I understood perfectly fine. Compressing again never helps. Because if you compress two similar files separately, the resulting archives are most likely not similar at all. That’s just how compression algorithms work. That’s also why, for maximum efficiency, a completely solid archive (no blocks) is needed: All files are compressed in one process. – Daniel B Sep 8 '15 at 16:56
  • All I can say is that I know first hand this works with things like text documents, and I've heard stories of 200 MiB files turning into around 40 MiB. Again, it's completely situational as to if you'll see an effect and the compression method matters a lot, but it does work. – Bugattikid2012 Sep 9 '15 at 6:52

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.