How to use ZFS on Linux

· Category: Linux

Short answer

ZFS is an advanced filesystem and volume manager with built-in snapshots, compression, and data integrity checking.

Steps

  1. Install ZFS:
sudo apt install zfsutils-linux
  1. Create a pool:
sudo zpool create mypool /dev/sdb
  1. Create a dataset:
sudo zfs create mypool/data
  1. Enable compression:
sudo zfs set compression=lz4 mypool/data
  1. Snapshot:
sudo zfs snapshot mypool/data@today

Tips

  • Scrub pools regularly to detect and repair bit rot.
  • Send snapshots incrementally for efficient backups.
  • ARC cache uses RAM; size it appropriately for your workload.

Common issues

  • ZFS is memory hungry; allocate sufficient RAM for the ARC.
  • Licensing concerns prevent ZFS from being included in the mainline Linux kernel.