ZFS is a file system focused on pooled storage, performance, and data integrity. It achieves this through the following mechanisms:
- Pooled storage: All physical drives on the server are added to a 'pool,' and storage space is drawn from this shared pool. The pool can be expanded simply by adding additional drives.
- Performance: ZFS uses several caching techniques to achieve fast read and write performance.
- Data integrity: When data is written, a checksum is calculated and stored alongside the data. When the data is read later, the checksum is recalculated. If this calculation does not match the stored checksum, a data error is detected, and ZFS will automatically attempt to correct it.
In addition to using ZFS for our Big Storage platform, we implement a RAID-Z setup. This setup uses four drives to write data and a fifth drive for parity.
For example, if the first four drives write 1, 0, 1, and 0 respectively, the fifth drive will store the sum, which is 2. If one drive fails, such as the third drive, ZFS automatically knows that it should contain a 1 and can restore the data after replacing the failed drive. If the fifth drive fails, ZFS knows it should have the value 2 and can also restore the data.