Btrfs vs. ZFS

Btrfs and ZFS are the two main file systems to choose from when you partition disks. This article looks at how they differ to help you select the right file system for your servers.

Btrfs vs. ZFS

image_pdfimage_print

With any new Linux server build, administrators need to determine the file system that supports fault tolerance without negatively impacting performance. The configured partition cannot be easily reconfigured, so you’re tied to the file system you choose. 

Btrfs and ZFS are the two main systems to choose from when you partition your disks. For basic servers, you might want the standard simpler approach Btrfs has to offer. More complex systems requiring better performance and storage capacity might be better using the ZFS file system.

What Is Btrfs?

The Linux Btrfs file system is built with fault tolerance in mind. When a user modifies a file and saves it to disk, a Btrfs partition disk will take a copy of the file before saving it. It’s a form of “shadow copying” where files are not actually overwritten on disk but instead are copied to preserve their original data every time the user saves them. Using Btrfs, administrators can offer fault tolerance and failover should a copy of a saved file get corrupted.

Fault tolerance and copies of saved files are the two best advantages of Btrfs. Btrfs also offers data compression to reduce the storage space required for saved files and subvolumes for administrators who want to create a volume for the operating system and a volume for user data. The latter provides better security in malware attacks if the attacker can only access the user volume.

No native support for encryption and storage limitations compared to ZFS are the two disadvantages of Btrfs. Third-party vendors provide encryption for Btrfs, so administrators have a workaround. The additional storage space is necessary for the shadow copies.

What Is ZFS?

A more enterprise server solution preferred by Linux administrators is the ZFS file system. ZFS also uses copy-on-write like Btrfs, which means that it takes a copy of a modified file instead of overwriting the original file on disk. The snapshots created from copy-on-write provide fault tolerance.

The Btrfs file system offers fault tolerance, but ZFS takes it a step further by giving administrators a redundant array of independent disks (RAID) system named RAID-Z. RAID-Z adds a feature for data storage spanning multiple disks, so a server with ZFS partitioning can process data from multiple disks much faster. Instead of waiting for a storage device to retrieve an entire file from one disk, RAID-Z lets the storage system simultaneously retrieve the file from multiple disks, which speeds up read times.

Every file system has limitations to the size of files it supports. The ZFS file system is made for servers, which usually need to store larger volumes of data. It’s one of the most scalable file systems offering 128-bit support, so it can store and quickly retrieve massive amounts of data. The maximum file size supported is 16 exabytes, and a ZFS partition supports up to 236 quadrillion zettabytes.

ZFS allows for more granular file access controls, so it also has hardened security for enterprise environments. The disadvantage is that ZFS security controls can be more difficult to manage. For the average user, the ZFS file system might be more difficult to manage than using the more standard Btrfs partitioning system.

Btrfs vs. ZFS

Once you choose a partitioning format, it’s a lot more effort to change it. Changing the partition requires transitioning to a new disk or repartitioning your current drive, so knowing the difference between Btrfs and ZFS will help you decide the right file system for your servers. The choice you make will determine your available fault tolerance, storage capabilities, performance, and features.

  • Performance: ZFS RAID support and 128-bit scalability offer better performance compared to Btrfs. The LZ4 compression algorithm used in ZFS is faster than the zlib used in the Btrfs file system.
  • Features: Both ZFS and Btrfs support file compression and RAID. The ZFS file system supports RAID-Z, which is equivalent to RAID 5 and RAID 6. RAID 5 allows for one drive to fail without losing data, and RAID 6 allows two drives to fail without losing data. Btrfs supports RAID 0, 1, 5, 6, and 10 (RAID 1 and RAID 0 combined). For deduplication, the ZFS file system supports the reduction of disk space needed when backing up files.
  • Data integrity and reliability: If you configure your storage for RAID 1 in Btrfs, then you have mirroring set up, which means that your data is duplicated on a separate disk. This requires additional storage for every drive, so server administrators might prefer the RAID 5 and RAID 6 configurations. Of the two options, RAID 5 is better for performance while still offering data integrity and reliability. RAID 6 allows for two failed disks, but it requires more disk space and doesn’t have the same performance. Use Btrfs for servers that don’t have mission-critical high-traffic applications that must provide fast performance. Use ZFS RAID 6 when you need high levels of data integrity and reliability.

For administrators determining which file system is best for their servers, consider Btrfs as a more basic choice. Servers supporting simple backups or low-volume activity can be configured to use Btrfs with mirroring for better backup performance and data integrity. For critical servers supporting a high volume of requests and important applications, ZFS is the better choice for its performance and RAID-Z features. Another advantage of ZFS is its security and ability to set file access controls across enterprise user accounts.

Conclusion

Building a new server takes a lot of time, but repartitioning a drive after choosing the wrong file system is much more of a challenge. For enterprise administrators, the ZFS file system is probably the most effective option provided that you have enough Linux experience to configure the file system properly. 

Pure Storage offers an easier and more convenient way to add storage to your environment without the time-consuming partitioning and disk configurations. Just choose the features that you need for FlashArray™ service, and you can have a storage device available in minutes. Our FlashBlade® products let you add fast performance for unstructured data, artificial intelligence, and analytics.

Written By: