GEOM compression layer for FreeBSD 5.3+

Update: Don't use it :) It's badly designed and has horrible performance. I'll probably write a real GEOM class to do it when I find the time.

ggcomp provides block-compression on the GEOM device layer, implemented as a ggate consumer in userland. It registers a ggate device with 8k sector size, which can be used to, e.g. host a UFS filesystem. Sectors written to it will be compressed on the fly using zlib (with the "fastest" compression level) and written to the underlying storage (which can be a device or a regular file). The compression ratio depends on the data being written, but it's actually not bad. Performance, on the other hand, suffers greatly, and you can expect about 10x worse performance on such compressed device, as compared to "regular" non-compressed performance.

It registers a device with "virtual" size and number of sectors that is some (configurable) factor larger than the physical media.

The code is still in development, but at this time it's pretty safe to use, and won't e.g. arbitrarily panic your kernel :). The only caveat concerns the borderline case when the physical device gets full, or no more blocks can be assigned to compressed data. In that case, ggcomp returns EIO to the upper layers.

Download

You can download ggcomp here. It's a source tree with included Makefile (just run 'make' to produce executables). See the included README file for recent news and usage examples.