From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Format:LMDB database file" |
|---|
| claim | "Meta page body (follows the page header on pages 0 and 1): magic, data version, fixed-mapping address, map size, the two MDB_db records, last used page and the committing txnid. Without MDB_VL32 mm_address is pointer-sized." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:LMDB database file" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "MDB_meta" |
|---|
| size | 136 |
|---|
| abi | "64-bit native endian, mdb.master3" |
|---|
| fields | | offset | "0x0" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "mm_magic" |
|---|
| bits | "0xBEEFC0DE" |
|---|
|
| offset | "0x4" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "mm_version" |
|---|
| bits | "MDB_DATA_VERSION: 3, or 999 if MDB_DEVEL" |
|---|
|
| offset | "0x8" |
|---|
| size | 8 |
|---|
| type | "void*" |
|---|
| name | "mm_address" |
|---|
|
| offset | "0x10" |
|---|
| size | 8 |
|---|
| type | "mdb_size_t" |
|---|
| name | "mm_mapsize" |
|---|
|
| offset | "0x18" |
|---|
| size | 96 |
|---|
| type | "MDB_db[2]" |
|---|
| name | "mm_dbs" |
|---|
| bits | "[0] free DB (md_pad = page size), [1] main DB" |
|---|
|
| offset | "0x78" |
|---|
| size | 8 |
|---|
| type | "pgno_t" |
|---|
| name | "mm_last_pg" |
|---|
|
| offset | "0x80" |
|---|
| size | 8 |
|---|
| type | "txnid_t" |
|---|
| name | "mm_txnid" |
|---|
|
|
|---|
| endianness | "native" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "struct MDB_meta member order; size = 4+4+8+8+2*48+8+8 summed from the member types (not from sizeof); MDB_metabuf at 1401 places it after char mm_pad[PAGEHDRSZ], so on a 64-bit build the magic is at file offset 24 and the page size (mm_dbs[0].md_pad) at file offset 48." |
|---|
| repo | "https://github.com/LMDB/lmdb" |
|---|
| commit | "253ba5219172531b719bc14fee6b4aa1a2a5c4a5" |
|---|
| path | "libraries/liblmdb/mdb.c" |
|---|
| lines | "694-697, 1370-1399" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "MDB_meta" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-19T11:32:06.928Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T11:54:42.879Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read mdb.c 1362-1399 at the cited commit: member order and types match; size 4+4+8+8+2*48+8+8 = 136 recomputed with MDB_db = 4+2+2+5*8 = 48 and pgno_t/mdb_size_t = size_t (lmdb.h 203, midl.h 46); mm_address pointer-sized without MDB_VL32; MDB_DATA_VERSION (MDB_DEVEL?999:3) at 697." |
|---|
|
|
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T12:40:33.225Z" |
|---|
| summary | "Set byte order native: LMDB writes its C structs in host byte order (files are not portable across endianness)." |
|---|
| changed | |
|---|
|
|
|---|