What does a ZFS pool calculator do?
A ZFS pool is built from vdevs, and each vdev is a group of drives in a layout: a single drive, a mirror, or RAIDZ with one, two or three parity drives. Planning one by multiplying the drives by their size gives the wrong answer. Parity takes space, ZFS keeps labels on every drive, it reserves a slice of the pool so you can still delete files when it is full, and RAIDZ pads small blocks. A zpool list and a zfs list of the same pool show different numbers, and both are smaller than the sum of the drives.
This calculator takes the layout, the drives per vdev, the number of vdevs, the drive size, the sector size (ashift) and the block size, and estimates what you can store. It shows the usable space, the amount that is comfortable to fill (80 percent), the raw size that zpool list calls SIZE, the share of raw space that holds data, the space lost to RAIDZ padding, the slop space, how many drives each vdev survives and how many drives to buy.
The formulas follow how ZFS allocates: data sectors plus parity per row, rounded up to a multiple of parity plus one, 4.5 MiB of labels per drive, and a slop of 1/32 of the pool, never less than 128 MiB or more than 128 GiB. Everything runs in your browser and nothing is uploaded. For a classic RAID array on a hardware controller use the RAID calculator, and for converting between TB and TiB use the data size converter.
How to calculate the size of a ZFS pool
- Choose the "Layout of each vdev": Stripe (no redundancy), Mirror, RAIDZ1 (one parity), RAIDZ2 (two parity) or RAIDZ3 (three parity). It opens on RAIDZ2.
- Set "Drives per vdev". A mirror needs at least 2, RAIDZ1 at least 2, RAIDZ2 at least 3 and RAIDZ3 at least 4; a stripe has exactly one. Choosing a layout adjusts the number for you.
- Set the "Number of vdevs". A pool with two vdevs of six drives has twelve drives and twice the raw space.
- Enter the "Size of each drive" and the unit: GB, TB, PB, GiB or TiB.
- Pick the sector size, "Sector size (ashift)". Almost every drive today is 4 KiB, which is ashift 12. The list also has 9 (512 B) and 13 (8 KiB).
- Pick the "Block size": 4 KiB, 8 KiB, 16 KiB, 64 KiB, 128 KiB or 1 MiB. Use the dataset recordsize (the default is 128 KiB) or the zvol volblocksize.
- Add "Hot spares (extra)" if you will keep spare drives. They count as drives to buy but do not add space.
- Read the result. The first line is the usable space in powers of 1000 and of 1024, and each row has a short note.
Mirrors suit virtual machines and databases, RAIDZ suits large files and archives. If your RAIDZ vdev is narrower than recommended, a yellow message says how many drives work best.
Examples
Six 4 TB drives in RAIDZ2
The default values: one vdev, ashift 12, 128 KiB blocks. A 128 KiB block has no padding loss on six drives, so the share of raw space that holds data is 66.7 percent, equal to the ideal (6 minus 2, over 6).
Raw size (zpool list SIZE): 21.83 TiB
Usable space: 15.86 TB (14.43 TiB)
Comfortable to fill (80 %): 12.69 TB (11.54 TiB)
Share of raw space that holds data: 66.7 % (ideal 66.7 %)
Slop space: 128 GiB
Failures each vdev survives: 2 drives
Drives to buy: 6Notice that the slop reaches its 128 GiB ceiling on a pool this size.
RAIDZ1 with 4 KiB blocks on three drives
Three 4 TB drives in RAIDZ1 with a 4 KiB block (a zvol, say). The ideal efficiency is 66.7 percent, but a small block fills a whole stripe with padding, and the share that holds data falls to 50 percent. The tool adds a row, "Lost to RAIDZ padding", of about 1.82 TiB. Usable space is 5.86 TB instead of the 7.9 TB you might expect. Larger blocks, or a mirror, waste less.
Three mirrors of two drives
Layout Mirror, 2 drives per vdev, 3 vdevs, 4 TB each. Raw size is 21.83 TiB, half holds data (50 percent), usable space is about 11.86 TB and each vdev survives 1 drive. Adding more mirror vdevs grows the pool a pair at a time.
Wide RAIDZ2 with ten drives
RAIDZ2 on ten drives with 128 KiB blocks: 32 data sectors, 4 rows of 2 parity sectors make 40, rounded up to a multiple of 3 gives 42. The efficiency is 32/42, about 76.2 percent, a little under the ideal 80 percent.
Common errors and how to fix them
| Message | What to do |
|---|---|
| This layout needs at least N drives per vdev (a stripe has exactly one). | Add drives to the vdev, or pick a layout with a lower minimum. |
| The number of vdevs must be 1 or more. | Type 1 or more. |
| Enter the size of each drive. | Type a size above zero. |
| The ashift is from 9 to 16. | Use one of the listed values, normally 12. |
| The block size must be at least one sector and at most 16 MiB. | Choose a block at least as large as the sector size; 4 KiB with ashift 12 is the smallest. |
| The number of spares must be 0 or more. | Use zero if you have none. |
The yellow message "RAIDZ works best with at least N drives per vdev" is a warning, not an error. With fewer drives the capacity advantage over a mirror is small.
The figures are estimates of an empty pool. Compression, snapshots, special devices, reservations and quotas change what you can store, and a fixed-size reservation is not counted.
FAQ
Why is my pool smaller than the sum of the drives?
Parity takes its share, ZFS writes labels on each drive, it keeps slop space of 1/32 of the pool, and RAIDZ can waste space on padding. Drives are also sold in TB while the system often shows TiB. The result shows each part.
Why keep the pool under 80 percent?
When a ZFS pool gets fuller, writes slow down and files fragment. The "Comfortable to fill" row is 80 percent of the usable space and is a good limit to plan for.
What is ashift and which one do I choose?
It is the sector size as a power of two: 9 is 512 bytes, 12 is 4 KiB, 13 is 8 KiB. Almost every drive now has 4 KiB sectors, so 12 is the usual answer. It cannot be changed after the vdev is created.
Mirror or RAIDZ?
Mirrors give less space but better random performance and faster growth, a pair at a time. RAIDZ gives more space for the same number of drives. RAIDZ2 is the usual choice for large drives, because rebuilding takes long.
Do spares add capacity?
No. A hot spare sits idle until a drive fails. The tool counts it as a drive to buy and nothing else.