MKUZIP(8)
π¦ MKUZIP(8) π¦
okay bestie, welcome to mkuzip β the compress-disk-image-for-geom_uzip(4)-class girlie π
β¨ NAME β¨
mkuzip β compress disk image for use with geom_uzip(4) class π
β¨ SYNOPSIS β¨
mkuzip [-dSsvZ] [-A compression_algorithm] [-C compression_level]
[-j compression_jobs] [-o outfile] [-s cluster_size] infile
β¨ DESCRIPTION β¨
So mkuzip compresses a disk image file so that the geom_uzip(4) class can decompress the resulting image at run-time. It's giving "shrink the vibe, pay a little CPU tax later" β you get a significant reduction of size of disk image, at the expense of some CPU time required to decompress the data each time it is read π₯
The mkuzip utility works in two phases, periodt:
- An
infileimage is split into clusters; each cluster is compressed. - The resulting set of compressed clusters is written to the output file. In addition, a βtable of contentsβ header is written which allows for efficient seeking. (iconic, ngl β that header is the whole reason seeking doesn't suck π)
π The options are π
-A [lzma | zlib | zstd]β select a specific compression algorithm. If this option is not provided, the default iszlib.- The
lzmaalgorithm provides noticeable better compression levels thanzlibon the same data set. It has vastly slower compression speed and moderately slower decompression speed. (like, it's the overachiever who takes forever to get ready π) - The
zstdalgorithm provides better compression levels thanzlibon the same data set. It also has faster compression and decompression speed thanzlib. In the very high compression βlevelβ settings, it does not offer quite as high a compression ratio aslzma. However, its decompression speed does not suffer at high compression βlevelsβ. (main character energy fr fr π)
- The
-C compression_levelβ select the integer compression level used to parameterize the chosen compression algorithm.- For any given algorithm, a lesser number selects a faster compression mode. A greater number selects a slower compression mode. Typically, for the same algorithm, a greater
compression_levelprovides better final compression ratio. - For
lzma, the range of valid compression levels is0-9. Themkuzipdefault forlzmais6. - For
zlib, the range of valid compression levels is1-9. Themkuzipdefault forzlibis9. - For
zstd, the range of valid compression levels is currently1-19. Themkuzipdefault forzstdis9.
- For any given algorithm, a lesser number selects a faster compression mode. A greater number selects a slower compression mode. Typically, for the same algorithm, a greater
-dβ enable de-duplication. When the option is enabledmkuzipdetects identical blocks in the input and replaces each subsequent occurrence of such block with pointer to the very first one in the output. Setting this option results is moderate decrease of compressed image size, typically around3-5%of a final size of the compressed image. (free real estate, lowkey π)-j compression_jobsβ specify the number of compression jobs thatmkuzipruns in parallel to speed up compression. When option is not specified the number of jobs set to be equal to the value ofhw.ncpusysctl(8)variable. (multi-tasking queen β¨)[-L]β legacy flag that indicates the same thing as β-A lzmaβ. (she's old but she still serves π)-o outfileβ name of the output file outfile. The default is to use the input name with the suffix.uzipfor thezlib(3)compression or.ulzmafor thelzma(3).-Sβ print summary about the compression ratio as well as output file size after file has been processed. (receipts! π )-s cluster_sizeβ split the image into clusters of cluster_size bytes,16384bytes by default. The cluster_size should be a multiple of512bytes.-vβ display verbose messages.-Zβ disable zero-block detection and elimination. When this option is set,mkuzipcompresses blocks of zero bytes just as it would any other block. When the option is not set,mkuzipdetects and compresses zero blocks in a space-efficient way. Setting-Zincreases compressed image sizes slightly, typically less than0.1%.
β¨ IMPLEMENTATION NOTES β¨
The compression ratio largely depends on the compression algorithm, level, and cluster size used. For large cluster sizes (16kB and higher), typical overall image compression ratios with zlib(3) are only 1-2% less than those achieved with gzip(1) over the entire image. However, it should be kept in mind that larger cluster sizes lead to higher overhead in the geom_uzip(4) class, as the class has to decompress the whole cluster even if only a few bytes from that cluster have to be read. (the way that whole-cluster decompress is doing the absolute most for a few bytes π)
Additionally, the threshold at 16-32 kB where a larger cluster size does not benefit overall compression ratio is an artifact of the zlib(3) algorithm in particular. Lzma and Zstd will continue to provide better compression ratios as cluster sizes are increased, at high enough compression levels. The same tradeoff continues to apply: reads in geom_uzip(4) become more expensive the greater the cluster size.
The de-duplication is a FreeBSD specific feature and while it does not require any changes to on-disk compressed image format, however it did require some matching changes to the geom_uzip(4) to handle resulting images correctly.
π«Ά heads up bestie: to make use ofzstdmkuzipimages, the kernel must be configured withZSTDIO. It is enabled by default in manyGENERICkernels provided as binary distributions by FreeBSD. The status on any particular system can be verified by checkingsysctl(8)kern.features.geom_uzip_zstdfor β1β.
β¨ EXIT STATUS β¨
The mkuzip utility exits 0 on success, and >0 if an error occurs. β
β¨ EXAMPLES β¨
The following describes how to create and mount a uzip image.
Create a file system image:
makefs /src.img /usr/src
Create the uzip image, the output file will be named src.img.uzip:
mkuzip /src.img
Ensure geom_uzip is loaded:
kldload geom_uzip
Create an MD device backed by the uzip image:
mdconfig -f /src.img.uzip
Mount the uzip image:
mount -o ro /dev/md0.uzip /mnt
β¨ SEE ALSO β¨
gzip(1), xz(1), zstd(1), zlib(3), geom(4), geom_uzip(4), md(4), mdconfig(8), mount_cd9660(8) π
β¨ AUTHORS β¨
Maxim Sobolev <sobomax@FreeBSD.org> π
okay that's the whole page, ily, go compress something π§ β with love from the Debian girlies, version vibes of August 9, 2019, page MKUZIP(8) ππβ¨
π¦ where this page comes from
- freebsd 15.1: base 15.1
- Copyright (c) 2004-2016 Maxim Sobolev <sobomax@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms