VMware's note names the type: "vmfsSeSparse is for space-efficient sparse disk for new-style redo logs". It does not
describe the file. The only public description is the reader in QEMU's block/vmdk.c (read in full for this page: the
comment above its checks says "Strict checks - format not officially documented"), written for ESXi snapshot images. Everything
below is what that code reads; fields it does not use are shown as such. In a descriptor the extent line is
RW sectors SESPARSE "name-sesparse.vmdk" and the create type is seSparse (QEMU's spelling;
VMware's note spells it vmfsSeSparse). All numbers are 64-bit little-endian; offsets and sizes are in 512-byte sectors.
Constant header (sector 0, 512 bytes)
| Offset | Size | Name | Description (QEMU) |
|---|---|---|---|
0 | 8 | Magic | 0x00000000CAFEBABE (bytes BE BA FE CA 00 00 00 00). |
8 | 8 | Version | QEMU accepts only 0x0000000200000001. |
16 | 8 | Capacity | The disk's size in sectors. |
24 | 8 | Grain size | Sectors per grain: QEMU accepts only 8 (4 KiB). |
32 | 8 | Grain table size | Sectors per grain table: QEMU accepts only 64 (32 KiB, 4,096 entries of 8 bytes). |
40 | 8 | Flags | QEMU accepts only 0. |
48 to 79 | 4 × 8 | Reserved 1 to 4 | QEMU rejects a file where any is not zero. |
80, 88 | 8, 8 | Volatile header offset, size | Where the volatile header is (see below). |
96, 104 | 8, 8 | Journal header offset, size | Read by nothing in QEMU; the content is not described. |
112, 120 | 8, 8 | Journal offset, size | Read by nothing in QEMU; the content is not described. |
128, 136 | 8, 8 | Grain directory offset, size | Level 0 of the metadata; the size is in sectors, so the directory has size × 512 ÷ 8 entries. |
144, 152 | 8, 8 | Grain tables offset, size | Level 1: the grain tables, one after another. |
160, 168 | 8, 8 | Free bitmap offset, size | Not read by QEMU. |
176, 184 | 8, 8 | Backmap offset, size | Not read by QEMU. |
192, 200 | 8, 8 | Grains offset, size | The sector where grain number 0 starts, and the size of the grain area. |
208 | 304 | Padding | QEMU rejects a file where it is not zero. |
Volatile header (512 bytes, at the volatile header offset)
| Offset | Size | Name | Description (QEMU) |
|---|---|---|---|
0 | 8 | Magic | 0x00000000CAFECAFE. |
8 | 8 | Free grain table number | Named free_gt_number in QEMU's structure; its use is not described. |
16 | 8 | Next transaction sequence number | Named next_txn_seq_number; its use is not described. |
24 | 8 | Replay journal | Non-zero means the image is dirty and its journal must be replayed; QEMU refuses such an image ("Replaying journal not supported"). |
32 | 480 | Padding | QEMU rejects a file where it is not zero. |
Grain directory and grain tables
A grain directory entry is 64 bits. 0 means the grain table is not allocated. Otherwise the top 32 bits shall be
0x10000000 (QEMU: the top nibble is 1 for an allocated table, and the maximum size of about 64 TB keeps the number below
232) and the low 32 bits are the table number t; the table is at sector
tables offset + t × 64. Each table covers 4,096 grains, 16 MiB of the disk.
A grain table entry is 64 bits; the top nibble is its type:
| Top nibble | Meaning |
|---|---|
0 | Not allocated; the whole value shall be 0 (QEMU treats another value as an error). Reads as zeros here, or from the parent. |
1 | "scsi-unmapped grain" (QEMU's comment): reads as zeros. |
2 | Zero grain: reads as zeros. |
3 | Allocated. The grain number is ((entry & 0x0FFF000000000000) >> 48) | ((entry & 0x0000FFFFFFFFFFFF) << 12), and the grain is at sector grains offset + number × grain size. |
| other | Not valid (QEMU: an error). |
To read sector s: grain directory index = s ÷ 32,768; entry index in the table = (s ÷ 8) mod 4,096; then as above.
Not described
Unknown
- Reference: the journal and journal header, the free bitmap, the backmap, the flags, the use of
free_gt_numberandnext_txn_seq_number, and whether other grain sizes or versions exist. No public source describes them (QEMU does not use them). The author of QEMU’s reader wrote on 8 March 2020, answering a request for the journal’s structure, that he does not know how the journal is implemented or what its structures look like; he could only say, from VMware’s log lines, that it is 2,048 sectors with a 2-sector header, a buffer of “write what where” records that is executed when the image is opened dirty (qemu-devel, “Regarding SESparse support in QEMU”). - Viewer: the journal cannot be replayed because no record layout is public, and a replay built on a guess would be wrong. The viewer draws the journal and its header by position and size, says whether their bytes are all zeros or how many sectors are not (and which), reports a dirty image, and reads the virtual disk from the grain tables as they stand.