To store more data on a ZFS file system, the ZFS compression strategy is a lightweight feature that works specifically on Linux-based servers. You can use ZFS on Linux operating systems such as Solaris, MacOS, Ubuntu, and FreeBSD. Network attached storage (NAS) administrators can use ZFS compression on systems such as TrueNAS.
What Is ZFS Compression?
Administrators can use ZFS compression quickly using a few commands, and the tool will reduce the storage size necessary to save data. The goal is to reduce file storage and allow additional data to be stored on the device. ZFS compression is specifically designed for the ZFS file system available on Linux-based machines.
The ZFS compression tool tells you exactly how much space you save after compressing files. Using the statistics, administrators can identify if compressed files are saving enough space to make it worth their while to continue using compression. For large enterprise servers, it’s generally beneficial to use compression to save money and resources.
How ZFS Compression Works
ZFS compression is completely invisible to the user, so only administrators are aware of file compression. Although using compression increases resource usage, users should not see a change in storage speed. It’s important to note that files themselves are not compressed. Instead, ZFS compression compresses based on record. A record in file storage is a collection of files.
When a file is saved, the file itself is not compressed, but the record is initially compressed before being stored. If ZFS cannot compress the file, the file is stored in its uncompressed form to avoid losing data. The amount of compression is set using various algorithms. For example, the lz4 compression algorithm uses a ratio of 1.61. The gzip algorithm uses a ratio of 2.27. Administrators can also set their own compression rate.
Benefits of Using ZFS Compression
The biggest benefit of using ZFS compression is the savings on storage space. With compression, you can store more data in the same amount of storage space. A company can save money on infrastructure by not having to buy more storage space.
Cost savings is often the indirect benefit most corporations experience. With large NAS environments, compression can save several gigabytes in storage. Storage is expensive, so using ZFS compression can save corporations thousands in additional hardware and infrastructure costs.
How to Enable ZFS Compression
Administrators first need to enable ZFS compression. Operating systems disable ZFS compression by default. Here’s an example command to enable ZFS compression on Ubuntu:
zfs set compression=lz4 newvol
Notice that compression is configured for “newvol.” Data stored on this volume will be compressed. You should change the name of “newvol” to your own volume name to enable compression. You can always disable ZFS compression later if you determine that it’s slowing down system performance.
Common Use Cases for ZFS Compression
Enterprise storage is usually a distributed system using a NAS. Administrators with large storage silos can save several gigabytes of storage. They reduce the amount of space being used, so users can save more files without notifications that they have no more storage space available.
Using compression takes a toll on computing resources, so administrators should test their environment before deploying ZFS compression to all storage devices. Administrators will see a spike in CPU usage, even in environments with plenty of computing power. As long as the server environment can handle the increase in CPU usage, the savings on storage costs will offset the CPU expense.
Conclusion
For corporations with high storage costs, using ZFS compression can help reduce those costs. ZFS compression is only available for Linux systems, so Windows administrators must work with a different compression algorithm. The ZFS compression algorithm is mainly used in enterprise applications where NAS and distributed storage is used.
Pure Storage supports cost savings and energy savings from compression. Learn how our Purity operating environment and FlashArray™ systems can fit in with your ZFS compression strategies.