The .mbfu image format
Version dated 18 November 2026.
.mbfu is an image container: a fixed 126-byte header, zlib compression and a SHA-256 integrity check. The format is publicly documented so images can be read and verified without running the program.
Why a custom container
- Streaming writes. The image can be unpacked straight onto a device without using disk space: a fixed-size header followed by one deflate stream.
- Integrity. SHA-256 is computed over the uncompressed data and verified both on extraction and after writing to a USB drive.
- Metadata. The header carries the original file name and the media type, so an image shows where it came from.
- Size. MS-DOS images compress well: deflate removes megabytes of empty space and repeated sectors.
File structure
The header is 126 bytes, all multi-byte integers are little-endian, no padding. In
struct terms: <8sHBBHQQ32s64s.
| Offset | Size | Field | Value |
|---|---|---|---|
| 0 | 8 | magic | MBFUIMG\x01 |
| 8 | 2 | version | uint16, currently 1 |
| 10 | 1 | image_type | uint8: 0 raw image, 1 floppy, 2 hard disk |
| 11 | 1 | compression | uint8: 1 — zlib (deflate) |
| 12 | 2 | reserved | uint16, always 0 |
| 14 | 8 | raw_size | uint64, uncompressed image size in bytes |
| 22 | 8 | data_size | uint64, compressed stream size in bytes |
| 30 | 32 | sha256 | SHA-256 of the uncompressed image |
| 62 | 64 | name | original file name, ASCII, zero-padded |
The header is followed by a single zlib stream whose length equals
data_size. There are no extra fields, directories or alignment — so
the file can be read sequentially without knowing its size in advance.
Reading an image
A minimal Python example using only the standard library:
import hashlib, struct, zlib
HDR = "<8sHBBHQQ32s64s"
SIZE = struct.calcsize(HDR) # 126
def read_header(path):
with open(path, "rb") as f:
buf = f.read(SIZE)
magic, ver, itype, comp, res, raw, dsize, digest, name = struct.unpack(HDR, buf)
if magic != b"MBFUIMG\x01":
raise ValueError("not an .mbfu image")
return {"version": ver, "image_type": itype, "compression": comp,
"raw_size": raw, "data_size": dsize,
"sha256": digest.hex(),
"name": name.rstrip(b"\0").decode("ascii", "replace")}
def extract(src, dst):
info = read_header(src)
h = hashlib.sha256()
with open(src, "rb") as f, open(dst, "wb") as out:
f.seek(SIZE)
dec = zlib.decompressobj()
while True:
chunk = f.read(1 << 20)
if not chunk:
break
data = dec.decompress(chunk)
if data:
h.update(data)
out.write(data)
tail = dec.flush()
if tail:
h.update(tail)
out.write(tail)
if h.hexdigest() != info["sha256"]:
raise ValueError("checksum mismatch")
return info
The hash check is mandatory: a truncated or corrupted file may still decompress without a zlib error if it was cut on a block boundary, and only SHA-256 catches it.
What the program accepts
.mbfu— the custom container;.img,.ima— raw floppy and disk images;.vhd,.vfd— virtual machine and floppy images.
Raw images are written to the device as they are; .mbfu is unpacked while writing, and the hash is compared with the header afterwards.
Limits
- an image larger than 4 GB will not open in DOSBox 0.72 — it silently exposes an empty disk, so the image editor is limited to that size;
- writing to a USB drive works for larger images too, but the DOS partition is still bound by FAT16;
- the file name in the header is ASCII; Cyrillic characters are replaced with safe ones, which does not affect the image itself.
Legal status
The format description is open: you may implement .mbfu reading in your own tool. MBFUTool 2.x itself is proprietary and its source code is not published; the terms are in the licence agreement.
Format version 1. If the header changes, the version field will be
bumped and older files will keep working.