ZFS
- Understand what ZFS is and why it's useful
ZFS is widely used in the world of servers, NAS systems (like FreeNAS / TrueNAS), virtualization, and even by tech-savvy individuals who want reliable storage. It is both a file system (like NTFS for Windows, EXT4, FAT32, etc.) and a volume manager (similar to LVM).
To put it simply:
- A volume manager organizes physical storage (like one or more hard drives).
- A file system organizes how data blocks are written, read, and deleted within those volumes.
ZFS goes far beyond traditional file systems in terms of performance and features.
Here’s what we’re most interested in:
- Its snapshot management features, allowing you to quickly roll back in case of issues.
- Its support for disk groupings and RAID-like structures (Z-Mirror, RAIDZ1, RAIDZ2, RAIDZ3).
- Its automatic recovery of corrupted data (through scrubbing).
- Its performance, enhanced by RAM caching (ZFS ARC).
- Its robust error notifications and monitoring.
Structure
ZFS has a unique structure:
- vdev (virtual device): a group of physical or virtual disks.
- zpool: a collection of vdevs configured as a single storage pool. A zpool can contain multiple vdevs, but a vdev belongs to only one zpool.
- dataset: a logical data container within a zpool. Each dataset can have its own settings (compression, quotas, permissions, etc.).
There are several dataset types:
- file system: a standard ZFS filesystem, mounted without storage quotas.
- zvol: a "virtual disk" with a defined size, which you can format and partition as if it were a physical disk.
- snapshot: a frozen-in-time version of another dataset. Snapshots can be created manually or through backup tools. They can be mounted to browse data as it was at the snapshot time.
Why ZFS over others?
Data Integrity
ZFS continuously checks that your stored data hasn't become corrupted. Every block of data is associated with a checksum, allowing ZFS to detect even the smallest alteration. If corruption is found and a healthy copy exists elsewhere, ZFS can repair the data automatically.
Built-in RAID
ZFS includes its own volume management system (vdevs). You can build a zpool using multiple disks—similar to traditional RAID setups—but with more flexibility. For example:
- Z-mirror → equivalent to RAID 1
- RAIDZ1 → equivalent to RAID 5 (tolerates 1 disk failure)
- RAIDZ2 → equivalent to RAID 6 (tolerates 2 disk failures)
- RAIDZ3 → tolerates up to 3 disk failures
ZFS handles all this natively—no external RAID software needed.
- Check out the article on RAID to find the right solution for your needs.
Snapshots and Clones
ZFS allows you to create snapshots—instantaneous images of a dataset's state. Snapshots take up minimal space and can be scheduled frequently. You can also create clones: writable copies of snapshots.
Compression and Deduplication
ZFS can compress data on the fly (transparently to the user), saving disk space. It also supports deduplication (removing duplicate data), though this feature requires a lot of memory and is not recommended for all use cases.
Now you know why ZFS is the file system to deploy on your NAS.