FreeBSD 101 : ZFS filesystem Pool layout.


ZFS filesystem:

The ZFS filesystem manages storage in pools (Zpool). A ZFS storage pool is a logical representation of the physical storage devices underneath.
The ZFS filesystem could be seen as both a logical volume manager and a filesystem.

RAID definition:

RAID is a virtualization process that combines physical disks into logical units to go beyond the limitations storage devices have. RAID allows us to have redundancy for our data, improvement in performance(read/write access),...

Virtual Devices (VDEV):

VDEV is a kind of RAID container, the system views it as RAID group of disks.
The VDEV is where we choose the level of redundancy, VDEV can have pools of disks with different RAID configuration.

Zpool (ZFS filesystem pool) is made up of one or multiple identical VDEVs.
To protect data in a pool, we use VDEV with redundancy.
It is recommended to create VDEVs that contain the same number of disks to keep the same performance across the VDEVs.
We cannot remove disks from a pool or add disks to it after the VDEV is created

VDEV (Virtual devices):

ZFS supports different flavors of VDEV (RAID-Z variations).
For example using more than one VDEV in a pool creates RAID redundancy

VDEVs flavors:

Striped VDEVs  : is a VDEV composed of a single disk has no redundancy much like a RAID-0.

Mirror VDEVs : a mirror VDEV stores a complete copy of all the VDEV’s data on each disk.
You can lose all the drives but if one of the drives is still functioning in the VDEV, you can still access your data.
ZFS "reads" in the case of a mirrored VDEV are fast, it uses all the disks for reading data, the "writes" on the other hand are slow, since ZFS writes data to all the disks simultaneously.

VDEV RAID types:


RAID-Z or RAID-Z1 writes data and parity to all the disks. 
When a disk fails, RAID-Z uses the parity information to calculate the data of the failed disk.
RAID-Z VDEV needs at least three disks and can still function if one disks gets corrupted.
Once created, you can't add disks to RAID-Z or remove disks from it.


RAID-Z2 writes parity and data to all the disks in the virtual device (VDEV).
RAID-Z2 can still function with two failing disks. You can't add disks to RAID-Z2 or remove disks from it. 
RAID-Z2 is composed of four or more disks.


RAID-Z3 is t
riple parity RAID, data is still retrievable even with three failed disks.

Example (RAID-Z1):


Leave as a comment: