What Is ZFS?
Pooled Storage Instead of Fixed Partitions
ZFS is a file system and volume manager, first developed at Sun Microsystems, that combines storage pooling, copy-on-write, checksums, snapshots and compression in one system. It replaces the usual stack of partitions, RAID layers and separate file systems with a single integrated design.
ZFS groups disks into a pool. Datasets, which act as file systems, draw space from the pool as they need it, so no one has to guess in advance how large each partition should be. Adding capacity means adding a new group of disks, called a virtual device or vdev, to the pool.
Copy-on-Write, Checksums and Snapshots
Copy-on-write means that changed data is written to new blocks rather than overwriting the old ones. The file system switches to the new version only when the write completes. This avoids half-written states after a crash and keeps the on-disk structure consistent.
Checksums are calculated for every block and stored separately. When data is read, ZFS verifies it. If a disk silently returns wrong data, ZFS detects the mismatch, and with redundancy in the pool it can repair the block from a good copy.
Snapshots are read-only, point-in-time views of a file system. They are created almost instantly and take little space at first, growing only as live data changes. They let administrators recover files that were deleted or overwritten by mistake.
Compression, Redundancy and Memory Use
ZFS can compress data transparently. A compression setting on each dataset reduces the space used, and the CPU cost is often less than the disk time saved. Redundancy comes from mirrors or RAID-Z, a parity scheme built into ZFS that is designed to avoid the write hole problem of traditional RAID 5.
ZFS uses a large share of system memory as a read cache, so it benefits from generous RAM. Many administrators also use ECC memory on ZFS storage servers, because checksums protect data on disk while ECC protects data in memory.
A Storage Server Guarding Against Silent Errors
A host runs a storage server with a mirrored ZFS pool and takes a snapshot of customer data every night. One disk begins returning subtly corrupted data without reporting an error. The checksum mismatch is caught during a scrub, a routine full pass that reads and verifies every block, and the damaged blocks are repaired from the mirror.
Snapshots also help when a customer deletes a directory by mistake, because the previous night's snapshot still holds the old version. Snapshots live on the same pool, however, so they complement off-site copies rather than replacing them. For the closest alternative design, see ZFS vs Btrfs.
Frequently asked questions
Does ZFS need ECC memory?
ECC memory is strongly recommended with ZFS but not strictly required. ECC detects and corrects single-bit errors in RAM. ZFS checksums protect data on disk, so the two features cover different risks. Many administrators use ECC on storage servers because a memory error can damage data before it is written.
Is ZFS available on Linux?
Yes. OpenZFS provides ZFS for Linux, FreeBSD and other systems. Because of licensing differences, ZFS is not part of the mainline Linux kernel, so it is installed as a separately packaged module. Support depends on the distribution and the kernel version in use.