Format:APFS
| On this wiki | Facts · Code · Notes · Topics |
|---|
Apple's copy-on-write filesystem: a container whose block 0 is a container superblock with magic "NXSB" at byte 32 (after a 32-byte object header with a Fletcher-64 checksum), holding volumes whose superblocks carry "APSB".
Overview
An APFS container (partition type GUID 7C3457EF-0000-11AA-AA11-00306543ECAC in Format:GPT partition table) holds several volumes sharing space. Every metadata block starts with a 32-byte object header, so magics appear at byte 32 of a block rather than at byte 0. Little-endian. It replaced Format:HFS Plus on macOS and iOS.
Object header (32 bytes)
Checksum (u64) at 0, object id (u64) at 8, transaction id (u64) at 16, type (u32) at 24, subtype (u32) at 28. The checksum is a Fletcher-64 over the block without the checksum field, with lower and upper halves derived as 0xFFFFFFFF minus sums modulo 0xFFFFFFFF.
Container superblock
4096 bytes in the libfsapfs description (block size is a field). After the object header (type 0x80000001): signature "NXSB" at 32, block size (u32) at 36, block count (u64) at 40, feature flags at 48, 56 and 64, container UUID at 72, next object and transaction ids at 88 and 96, checkpoint area sizes and bases from 104, space manager object id at 152, object map block at 160, reaper at 168, maximum volumes at 180, and the array of 100 volume object ids at 184. Because the newest superblock lives in a checkpoint area, the block 0 copy can be older than the live one: Unverified: how to pick the newest (highest transaction id among superblocks in the checkpoint descriptor area) was not read.
Volume superblock
Object type 0x0000000d (0x4000000d for snapshots) after the header, signature "APSB" at 32, volume index at 36, feature flags at 40, 48 and 56, unmount time (nanoseconds since 1970) at 64, reserved and quota block counts at 72 and 80.
Analyst notes
- Encrypted volumes use a key bag referenced from the container superblock (nx_keybag_base near offset 1296); decrypting needs the user's key and is out of scope here.
- Unverified: fields after offset 80 of the volume superblock, the B-tree node formats and the object map are not summarized here; use the libfsapfs document.
Sources
libfsapfs documentation (Joachim Metz, GFDL-1.3) at cc12261.
Code & repositories
- https://github.com/libyal/libfsapfs @
cc122619a0fa5cecf7c077742ac62251fb85fb6c· license: LGPL-3.0-or-later (declared by the contributor for the files used; GitHub reports LGPL-3.0 for the repository)
libfsapfs by Joachim Metz; documentation/ describes the APFS container, volume, object map and B-tree structures.
Tested on: source read, not run: documentation read only · checked 2026-10-19; last activity 2026-10-10