MKUZIP(8) | MidnightBSD System Manager's Manual | MKUZIP(8) |
mkuzip
— compress
disk image for use with
geom_uzip(4)
class
mkuzip |
[-dLSsvZ ] [-j
compression_jobs] [-o
outfile] [-s
cluster_size] infile |
The mkuzip
utility compresses a disk image
file so that the
geom_uzip(4) class
will be able to decompress the resulting image at run-time. This allows for
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:
The options are:
-j
compression_jobsmkuzip
runs in parallel to speed up compression. When option is not specified the
number of jobs set to be equal to the value of
hw.ncpu
sysctl(8)
variable.-d
mkuzip
detects identical blocks in the input and
replaces each subsequent occurence 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 around 3-5% of a final size of the
compressed image.-L
-o
outfile-S
-s
cluster_size-v
-Z
mkuzip
would compress empty blocks (i.e.
clusters that consist of only zero bytes) just as it would any other
block. When the option is not set, the mkuzip
detects such blocks and skips them from the output. Setting
-Z
results is slight increase of compressed image
size, typically less than 0.1% of a final size of the compressed
image.The compression ratio largely depends on the cluster size used. For large cluster sizes (16K and higher), typical compression ratios are only 1-2% less than those achieved with gzip(1). 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 mkuzip
utility inserts a short shell
script at the beginning of the generated image, which makes it possible to
“run” the image just like any other shell script. The script
tries to load the
geom_uzip(4) class if
it is not loaded, configure the image as an
md(4) disk device using
mdconfig(8), and
automatically mount it using
mount_cd9660(8) on
the mount point provided as the first argument to the script.
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.
The mkuzip
utility exits 0 on
success, and >0 if an error occurs.
gzip(1), xz(1), lzma(3), zlib(3), geom(4), geom_uzip(4), md(4), mdconfig(8), mount_cd9660(8)
Maxim Sobolev <sobomax@FreeBSD.org>
February 19, 2019 | midnightbsd-3.1 |