ZFS combines a volume manager and a copy-on-write file system in one design with checksums, snapshots and pooled storage. It was created at Sun for Solaris (2005) and lives on in OpenZFS on FreeBSD, Linux, illumos and storage appliances such as TrueNAS. It is actively developed.
Overview
A ZFS pool is a tree of virtual devices. Each device carries four 256 KiB labels holding an XDR-encoded name/value list that describes the pool, and an uberblock array. Blocks are addressed by block pointers that contain checksums, so the pool is self-validating. Datasets are described in the DSL, and file system contents in object sets (DMU) with ZAP directories and dnodes.
History
Developed at Sun Microsystems from 2001 (Jeff Bonwick, Matt Ahrens); shipped in Solaris 10 in 2006.
OpenZFS became the common open source codebase from 2013 after the illumos fork.
Structures
Offsets are in bytes from the start of the structure named in each heading. Field names are descriptive and are not an official specification. Fixed-width integers are shown as u/i (unsigned/signed) followed by bit width and byte order.
Read Dataset
Offset
Size
Type
Field
Notes
0x30
8
u64 LE/BE
–
0x38
8
u64 LE/BE
–
0x48
8
u64 LE/BE
–
0x70
8
u64 LE/BE
–
0x80
128
bytes
Pointer
Walk Directory
Offset
Size
Type
Field
Notes
0x8
8
u64 LE/BE
Head
0x20
8
u64 LE/BE
Child Zap
Parse Sa
Offset
Size
Type
Field
Notes
0x0
4
u32 BE
–
0x4
2
u16 LE/BE
Info
lengthOffset
2
u16 LE/BE
Length
Parse Znode Phys
Offset
Size
Type
Field
Notes
0x0
16
bytes
Accessed
0x10
16
bytes
Modified
0x20
16
bytes
Changed
0x30
16
bytes
Created
0x40
8
u64 LE/BE
Generation
0x48
8
u64 LE/BE
Mode
0x50
8
u64 LE/BE
Size
0x58
8
u64 LE/BE
Parent
0x60
8
u64 LE/BE
Links
0x78
8
u64 LE/BE
Flags
0x80
8
u64 LE/BE
Uid
0x88
8
u64 LE/BE
Gid
Time
Offset
Size
Type
Field
Notes
0x0
8
u64 LE/BE
Seconds
0x8
8
u64 LE/BE
Nanoseconds
Parse List
Offset
Size
Type
Field
Notes
(cursor + 4)
4
i32 BE
Count
(cursor + i * 8)
8
u64 BE
–
(position + 4)
4
i32 BE
Decoded Size
cursor
4
i32 BE
Type
cursor
4
u32 BE
Value
cursor
8
u64 BE
Value
position
4
i32 BE
Encoded Size
Read Leaf
Offset
Size
Type
Field
Notes
position + 1
1
u8
Integer Length
position + 4
2
u16 LE/BE
Name Chunk
position + 6
2
u16 LE/BE
Name Length
position + 8
2
u16 LE/BE
Value Chunk
position + 10
2
u16 LE/BE
Value Count
Read Zap
Offset
Size
Type
Field
Notes
0x0
8
u64 LE/BE
Block Type
position
8
u64 LE/BE
–
position + 14
50
bytes
Name
Read Zap
Offset
Size
Type
Field
Notes
0x0
8
u64 LE/BE
–
0x18
4
u32 LE/BE
–
Zfs Block Pointer
Offset
Size
Type
Field
Notes
0x0
1
u8
Is Hole
0x0
1
u8
Cache Key
0x1
1
u8
–
0x1
1
u8
Cache Key
0x6
1
u8
Prop
0xA
1
u8
Birth
0xA
1
u8
Cache Key
0xB
1
u8
Fill
0xC
4
bytes
Expected Checksum
Fletcher2
Offset
Size
Type
Field
Notes
i
8
u64 LE/BE
–
i + 8
8
u64 LE/BE
–
Sha256
Offset
Size
Type
Field
Notes
0x0
8
u64 BE
–
0x8
8
u64 BE
–
0x10
8
u64 BE
–
0x18
8
u64 BE
–
Verify Embedded
Offset
Size
Type
Field
Notes
tail
8
u64 BE
–
tail + 8 + i * 8
8
u64 LE/BE
–
Parse
Offset
Size
Type
Field
Notes
0x0
1
u8
Type
0x1
1
u8
Indirect Shift
0x2
1
u8
Levels
0x3
1
u8
Pointer Count
0x4
1
u8
Bonus Type
0x7
1
u8
Flags
0x8
2
u16 LE/BE
Block Size
0xA
2
u16 LE/BE
Bonus Length
0xC
1
u8
Extra
0x10
8
u64 LE/BE
Max Block Id
0x18
8
u64 LE/BE
Used
size – 128
128
bytes
–
Parse Uberblock
Offset
Size
Type
Field
Notes
0x0
8
u64 BE
–
0x8
8
u64 LE/BE
Version
0x10
8
u64 LE/BE
Txg
0x20
8
u64 LE/BE
Timestamp
0x28
128
bytes
Root
Other fields read
Read in
Offset
Size
Type
Field
Notes
Decompress Lz4
0x0
4
u32 BE
Length
Add Snapshots
0x20
8
u64 LE/BE
Snap Zap
Parse Znode Phys
0x0
8
u64 LE/BE
–
Read String
position
4
i32 BE
Length
Open
0x2C0
8
u64 LE/BE
–
Read Array
offset + 22
2
u16 LE/BE
Chunk
Assemble Gang
512 – 40
8
u64 LE
Little Endian
Zfs Block Pointer
i * 8
8
u64 LE/BE
–
Fletcher4
i
4
u32 BE
–
Constants
Zfs Compression
Name
Value
Type
Notes
Inherit
0
int
On
1
int
Off
2
int
Lzjb
3
int
Empty
4
int
Gzip1
5
int
Gzip9
13
int
Zle
14
int
Lz4
15
int
Zstd
16
int
MatchBits
6
int
MatchMin
3
int
Zfs Zpl
Name
Value
Type
Notes
SaMagic
0x2F505A
uint
Zfs Nv List
Name
Value
Type
Notes
TypeBoolean
1
int
TypeByte
2
int
TypeInt16
3
int
TypeUInt16
4
int
TypeInt32
5
int
TypeUInt32
6
int
TypeInt64
7
int
TypeUInt64
8
int
TypeString
9
int
TypeUInt64Array
16
int
TypeHrTime
18
int
TypeNvList
19
int
TypeNvListArray
20
int
TypeBooleanValue
21
int
TypeInt8
22
int
TypeUInt8
23
int
Zfs Const
Name
Value
Type
Notes
LabelSize
256 * 1024
int
LabelNvListOffset
16 * 1024
int
LabelNvListSize
112 * 1024
int
LabelUberblockOffset
128 * 1024
int
LabelUberblockSize
128 * 1024
int
DataStart
4L * 1024 * 1024
long
UberblockMagic
0x00BAB10C
ulong
EckMagic
0x0210DA7AB10C7A11
ulong
DnodeSize
512
int
BlockPointerSize
128
int
Checksum algorithms (zio_checksum)
Name
Value
Type
Notes
ChecksumFletcher2
6
int
ChecksumFletcher4
7
int
ChecksumSha256
8
int
Object set types
Name
Value
Type
Notes
ObjsetMeta
1
ulong
ObjsetZfs
2
ulong
ObjsetZvol
3
ulong
Bonus types
Name
Value
Type
Notes
BonusZnode
17
byte
BonusSa
44
byte
Zfs Dnode
Name
Value
Type
Notes
FlagSpillPointer
0x4
byte
Zfs Module
Name
Value
Type
Notes
RegistryKey
“zfs:registry”
string
Implementation limits
Class
Name
Value
Notes
Zfs Dsl
MaxDepth
64
Zfs Dsl
MaxDatasets
100_000
Zfs File System
MaxOlderTxgs
16
Zfs File System
MaxLostEntries
100_000
Zfs File System
MaxVisitedPerTxg
200_000
Zfs File System
MaxSymlinkBytes
4096
Zfs Nv List
MaxDepth
16
Zfs Pool
CacheLimitBytes
64L * 1024 * 1024
Zfs Pool
MaxGangDepth
4
Zfs Object Set
MaxZapEntries
10_000_000
Zfs Dnode
FlagUsedBytes
0x1
Zfs Module
MaxSnapshotsPerDataset
64
Zfs Module
MaxMosAttempts
8
Zfs Module
MaxDestroyedScanTxgs
16
Structures and constants were extracted from the implementation. Prose sections are a summary from public sources; verify details before relying on them.