ZFS padding calculator: how much space does a block take on RAIDZ?

Version 1.0.3

See how much disk space one ZFS block really takes on a RAIDZ vdev once parity and padding are added, and compare block sizes before you set recordsize or volblocksize.

Have the RAIDZ level, the number of drives in the vdev, the block size, and the pool's ashift.

Geometry

RAIDZ level Required

Block model

Workload Required
recordsize Required
ashift Required

What to enter

Vdev width is the number of drives in this one RAIDZ vdev, not in the whole pool. zpool get ashift shows ashift. 12 means 4 KiB sectors.

Pick Filesystem for a dataset, where the setting is recordsize, or Zvol for a block device, where it's volblocksize. recordsize is the largest block a file uses, so files smaller than it use one smaller block.

Share configuration puts your inputs in a link you can send or bookmark.

An 8 KiB block on a six-drive RAIDZ2 with ashift=12

Example

PartSectorsSpace
Data28 KiB
Parity28 KiB
Padding28 KiB
Total624 KiB

The 8 KiB block takes 24 KiB on disk, so a third of the space holds data.

How does RAIDZ allocate a block?

RAIDZ splits the block into sectors, adds parity for each row of data sectors, then pads the total up to a multiple of parity plus one.

RAIDZ allocation

Formula

Data sectors = block size ÷ sector size, rounded up

Rows = data sectors ÷ (width - parity), rounded up

Parity sectors = rows × parity

Allocated sectors = data + parity, rounded up to a multiple of (parity + 1)

The sectors added by that last rounding are the padding. The OpenZFS RAIDZ guide explains how RAIDZ lays out data.

Which block size wastes the least space on RAIDZ?

Larger blocks, up to a point. On a six-drive RAIDZ2 with 4 KiB sectors:

Block sizeSpace on diskShare that holds data
4 KiB12 KiB33.3%
8 KiB24 KiB33.3%
16 KiB24 KiB66.7%
128 KiB192 KiB66.7%

From 16 KiB up, every block reaches the best this width can do, which is 4 data drives out of 6. That's why a zvol with small blocks can lose much more space on RAIDZ than a dataset with 128 KiB records.

Should I pick the most space-efficient block size?

Not on space alone. Block size also changes how fast reads and writes are and how well data compresses. A database that writes 8 KiB pages can run better with a matching small block, even on a less efficient layout. Use this calculator to see the space cost of that choice.

The result is for one uncompressed block. Compression, metadata, and snapshots change real use. For a whole pool, use the ZFS capacity calculator.