Skip to content

Add Support for geom_uzip Compression (FreeBSD mkuzip) #1125

@qkaiser

Description

@qkaiser

Description
geom_uzip is a FreeBSD feature for creating compressed disk images (usually containing UFS). The compression is done in blocks, and the resulting .uzip file can be mounted via the GEOM framework on FreeBSD.

References

How to Craft

  1. On a FreeBSD system, install or use the built-in mkuzip tool.
  2. Run:
    mkuzip -o compressed.uzip original.img
    This generates compressed.uzip from original.img.

Magic Value / Signature

  • Often starts with a shebang like
00000000  23 21 2f 62 69 6e 2f 73  68 0a 23 56 32 2e 30 20  |#!/bin/sh.#V2.0 |
00000010  46 6f 72 6d 61 74 0a 28  6b 6c 64 73 74 61 74 20  |Format.(kldstat |
00000020  2d 71 6d 20 67 5f 75 7a  69 70 7c 7c 6b 6c 64 6c  |-qm g_uzip||kldl|
00000030  6f 61 64 20 67 65 6f 6d  5f 75 7a 69 70 29 3e 26  |oad geom_uzip)>&|
00000040  2d 26 26 6d 6f 75 6e 74  5f 63 64 39 36 36 30 20  |-&&mount_cd9660 |
00000050  2f 64 65 76 2f 60 6d 64  63 6f 6e 66 69 67 20 2d  |/dev/`mdconfig -|
00000060  61 66 20 24 30 60 2e 75  7a 69 70 20 24 31 0a 65  |af $0`.uzip $1.e|
00000070  78 69 74 20 24 3f 0a 00  00 00 00 00 00 00 00 00  |xit $?..........|
00000080  00 00 40 00 00 00 03 7e  00 00 00 00 00 00 1c 80  |..@....~........|
00000090  00 00 00 00 00 00 1c 80  00 00 00 00 00 00 1c 80  |................|

How to Extract / Decompress

  • Tool: On FreeBSD, you can mount it as a block device:
    mdconfig -f compressed.uzip
    mount -t ufs /dev/md0 /mnt
  • Python Library: Likely no direct library. A custom parser or existing FreeBSD userland tool is required.

Determining End Offset

  • The mkuzip header includes a table with block counts and sizes.
  • By parsing each block entry, you can determine the total size of the compressed image.
  • unblob should parse the table, locate the last block, and compute the offset for the entire .uzip file.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions