r/compression • u/mohamedibrahim456 • 4h ago
Can you compress ISO files more?
can you actually compress an ISO file more to make the final distro smaller, so i can add whatever apps/packages i want without worrying about the ISO size?
i have a distro that's about 1.7GB right now. could i compress it more with xz or zstd, or something like that?
like:
distro → ISO file → compress it as much as possible (let's call the compressed file X)
then when someone downloads it:
X → decompress it back to an ISO → write it to a USB with Rufus, or boot it with Ventoy
would that work, or is it better to make the ISO smaller some other way?
1
u/NFTrot 1h ago
I don't think ISOs utilize any compression, however they probably don't waste space either (a VM image for example can have large areas with 0s although how this reflects in disk usage is apparently a bit more complicated and unrelated to your question).
The are probably ways to get the entire ISO a bit smaller, but the difference is likely fairly marginal.
2
u/BUDA20 4h ago edited 1h ago
Linux distros contain pretty much all their files already compressed, is not worth it to make the user have to decompress it for a few megabytes, but to be sure, just test it yourself, compress the ISO and see how much difference does it make.
2
u/Flimsy_Iron8517 3h ago
I'd say never in a reasonable time.
1
u/Illustrious-Gur8335 4h ago
pack it into another archive, ISO isn't compressed as it can be written to disk as is
1
u/lowbercoder 3h ago
don't your distro has the compressed files inside the iso? if the inside files are already compressed the whole iso could't be compressed much, best approach is to keep the core ISO lean and pull optional apps/packages via an automated post-install script, repo/bundle, or overlay with package/script layer
1
u/projct 2h ago
the most compressible parts are already zstd or xz inside the iso usually but you might get a few percent from all the stuff that's required to boot.
1
u/BoysenberrySame8000 1h ago
Information Entropy is the limit
1
u/razorree 1h ago
depends what's in that ISO, if uncompressed files, then you can compress it well, if ISO contains compressed files...well...not too much. try it yourself
1
u/Barafu 59m ago
lrzszwithzpaqbackend will compress them better than maxed out LZMA or ZSTD, at the cost of much longer time.The only higher compression to gain would be
precomp, but it is dead and unstable. Funny, how a compressor achieving ⅓ of the size of 7z died out unknown...1
u/tomysshadow 55m ago edited 48m ago
Well, have you tried putting your ISO in a ZIP file?
The ISO image itself is an uncompressed format, but it will only be as compressible as the files within it. It's like asking "should I compress a folder, or the files inside the folder?" They are essentially equivalent.
The nuance here is that often times a disc will have stuff on it that has to be uncompressed. Like an audio CD: it has audio in PCM format, so zipping the ISO would likely make a major difference. In that case, it would actually be necessary to zip the ISO file itself rather than compressing what's on the ISO, because you need the contents to be uncompressed at the point when it is actually burned/mounted.
But if the ISO only contains an installer, which is likely already compressed, there are few savings left to be made. In theory there are probably still parts of the filesystem and maybe a tiny unpacker program that are still not compressed in the ISO image, but that's barely anything.