I build my own FreeBSD disk images for all my server systems. In doing so, I recently discovered that I can create a ZSTD-compressed
geom_uzip() mfs_root image and build it statically into the kernel using this set of kernel config options:
In doing so, I see huge gains in compression ratio and the resulting image is quite tiny compared to the original MFS root md disk image. Thus, I'm wondering about the performance characteristics of embedding this geom_uzip mfs_root image into the kernel statically. Upon a fresh boot, will the entire image be decompressed exactly once before mounting it as the root filesystem (i.e. with no decompression on any subsequent reads)? Or will it stay in memory in its compressed form and every further read will add CPU overhead due to on-demand decompression of its compressed clusters?
A side question: what is the best way to benchmark the performance of a default mfs_root md image vs a zstd-compressed geom_uzip mfs_root image? I'd like to verify my hypothesis without experiencing interference in the results caused by possible filesystem caching.
geom_uzip() mfs_root image and build it statically into the kernel using this set of kernel config options:
Code:
# Make the md device a potential root device, either with preloaded
# images of type mfs_root or md_root.
options MD_ROOT
makeoptions MFS_IMAGE=/path/to/my/mfs_root.img.uzst
options ROOTDEVNAME=\"ufs:md0.uzip\"
# Write-protect the md root device so that it may not be mounted writeable.
options MD_ROOT_READONLY
In doing so, I see huge gains in compression ratio and the resulting image is quite tiny compared to the original MFS root md disk image. Thus, I'm wondering about the performance characteristics of embedding this geom_uzip mfs_root image into the kernel statically. Upon a fresh boot, will the entire image be decompressed exactly once before mounting it as the root filesystem (i.e. with no decompression on any subsequent reads)? Or will it stay in memory in its compressed form and every further read will add CPU overhead due to on-demand decompression of its compressed clusters?
A side question: what is the best way to benchmark the performance of a default mfs_root md image vs a zstd-compressed geom_uzip mfs_root image? I'd like to verify my hypothesis without experiencing interference in the results caused by possible filesystem caching.