Install ZFS on Ubuntu [Debian]
There are several ways to install ZFS on Ubuntu: using apt
, jonathonf's PPA, and compiling from sources.
OpenZFS is an advanced file system and volume manager that provides data integrity, protection against data corruption, scalability, and various storage features. It is an open-source implementation of the ZFS file system originally developed by Sun Microsystems for Solaris.
What is ZFS?
OpenZFS is an open-source file system and logical volume manager that provides advanced data storage features. It is based on the ZFS file system originally developed by Sun Microsystems for Solaris and later ported to various operating systems, including Linux and FreeBSD.
OpenZFS offers robust data protection, integrity, and scalability features. It supports features such as data compression, data deduplication, snapshotting, copy-on-write cloning, RAID-Z (similar to RAID but with enhanced reliability and flexibility), and the ability to create and manage multiple virtual storage pools.
OpenZFS has a large and active community of developers who continue to enhance and improve the file system. Its open-source nature allows for transparency, community contributions, and cross-platform compatibility.
OpenZFS is commonly used in enterprise environments, as well as by individual users and organizations seeking a reliable and feature-rich file system for their storage needs.
Ubuntu repo
Ubuntu comes with the ZFS package, but usually it is a bit outdated:
sudo apt install zfsutils-linux
To verify that ZFS is installed:
sudo zfs version
jonathonf's PPA
To install the latest ZFS version, add jonathonf's PPA:
sudo add-apt-repository ppa:jonathonf/zfs
And then install ZFS and zfs-dkms
to update ZFS Linux kernel modules:
sudo apt install zfsutils-linux zfs-dkms
Compile from sources
You can also compile and install ZFS from sources, but you will need to re-compile ZFS Linux kernel modules whenever Linix kernel is updated.
Install dependencies:
sudo apt install build-essential autoconf automake libtool gawk alien fakeroot dkms libblkid-dev uuid-dev libudev-dev libssl-dev zlib1g-dev libaio-dev libattr1-dev libelf-dev linux-headers-$(uname -r) python3 python3-dev python3-setuptools python3-cffi libffi-dev python3-packaging git
Compile ZFS:
git clone https://github.com/openzfs/zfs
cd ./zfs
git checkout master
sh autogen.sh
./configure
make -s -j$(nproc)
Unmount existing ZFS datasets and export pools:
sudo zfs unmount -a
sudo zpool export -a
sudo systemctl stop zfs-send
Unload existing ZFS modules:
sudo ./scripts/zfs.sh -u
Install newly compiled ZFS:
sudo make install
sudo ldconfig
sudo depmod
Load freshly built Linux modules:
sudo ./scripts/zfs.sh
And make sure that ZFS services are enabled:
sudo systemctl enable zfs.target zfs-import.target zfs-mount.service zfs-import-cache.service zfs-import-scan.service