ZFS on Linux 4.13 in Debian Jessie

The first question that comes to mind is why bother? The big reason, for me, is thunderbolt hot-plugging. Thunderbolt hot plugging made it into 3.17. Unfortunately, Debian Jessie ships with 3.16. Luckily, 4.12 and 4.13 are available from jessie-backports. If you want to use zfsonlinux, youʼll need to do quite a bit of extra work. zfsonlinux ships packages that depend on the 3.16 kernel. It’s also not as simple as just building the zfs package as they first create rpms and then convert them to debs. This is an issue because rpmbuild doesnʼt like the versioning scheme that is used for Debianʼs backported kernels.

To start with, youʼll need to download the source for the kernel to compile:

sudo aptitude install linux-source-4.3

Then youʼll need to untar the source into a writable directory. i.e. cd into the desired directory and run:

tar zxvf /usr/src/linux-source-4.3.tar.gz

This next step is going to take quite a while, building the kernel. From the untared linux source directory:

cp /boot/config-3.16.0-4-amd64 .config
make deb-pkg LOCALVERSION=-custom KDEB_PKGVERSION=$(make kernelversion)-1

You can feel free to change either LOCALVERSION or the suffix to KDEB_PKGVERSION just make sure that the values that you specify don’t contain a ..

Its much easier to do this without zfs already installed, so Iʼm just going to assume that is where you are at. Install the newly compiled kernel and reboot.

sudo dpkg -i linux-headers-4.3.3-custom_4.3.3-1_amd64.deb linux-image-4.3.3-brendan_4.3.3-1_amd64.deb
sudo reboot

Now you have a custom kernel version running. The next step is to install zfs. This is mostly following zfsonlinux’s instructions on generic debs but, their instructions are missing a couple of steps. Youʼll need to download spl and zfs from zfsonlinux. I would suggest grabbing the latest release. You’ll also need a few build dependencies.

sudo aptitude install build-essential gawk alien fakeroot linux-headers-$(uname -r) \
  zlib1g-dev uuid-dev libblkid-dev libselinux-dev parted lsscsi wget
wget http://archive.zfsonlinux.org/downloads/zfsonlinux/spl/spl-
wget http://archive.zfsonlinux.org/downloads/zfsonlinux/zfs/zfs-
tar zxvf spl-
tar zxvf zfs-
cd spl-0.6.5

Now we need to compile spl and install the development packages which are required for building zfs.

make deb-utils deb-kmod
cd module
cd ..
sudo dpkg -i kmod-spl-*.deb spl-*.deb
cd ..

Finally, we’re going to build and install zfs

cd zfs-0.6.5
make deb-utils deb-kmod
ln -s /lib64/libnvpair.so.1 /lib/nvpair.so.1
ln -s /lib64/libzfs.so.2 /lib/libzfs.so.2
sudo dpkg -i zfs-*.deb kmod-zfs-*.deb libnvpair1_*.deb libuutil1_*.deb libzfs2_*.deb libzpool2_*.deb

Finally reboot, and you should be all set. While that is a bunch of steps, it really isnʼt too bad.