r/compression • u/mohamedibrahim456 • 16h 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 13h 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.
3
u/BUDA20 16h ago edited 14h 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 16h ago
I'd say never in a reasonable time.
1
u/Illustrious-Gur8335 16h ago
pack it into another archive, ISO isn't compressed as it can be written to disk as is
1
u/lowbercoder 15h 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 14h 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 14h ago
Information Entropy is the limit
1
u/razorree 13h 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 13h 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 13h ago edited 12h 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.
1
u/dodexahedron 10h ago
The package repository contained in the installer iso is, at least for debian derivatives, made up of xz compressed archives already, and they form the majority of the size of the image.
What are you trying to accomplish?
Just stick it on a ventoy stick and forget about it.
1
u/vegansgetsick 6h ago
Compress it with zstd
1
u/gigayoink 3h ago
It's common for Linux ISOs to contain a nested loopback image with a compressed FS like squashfs mounted by the initramfs.
The benefits of this is that it fits on smaller media and doesn't require the user to decompress.
You can absolutely just compress the whole image instead , but then the user has to decompress it first, which is annoying and takes gigabyte of space on Windows.
Different rules apply for USB images that aren't strictly ISO-9660 images, since they're usually meant to be read/write.
(My information may be some years out of date)
0
u/Better_Ambassador759 9h ago
You could try Aqueous:
aqr -c --auto-dir --format sfx(Windows) -l 9/zstd22 --depth 3 -b 64G -S 0 -M 0 --application-bound unlimited -Z lzma=on/off