Howto build ZFS from source in Devuan 1.0 (Jessie)

Installing zfs-dkms 0.7.3 from backports contrib fails because it needs dkms > 2.2.1.0, but Debian has 2.2.0.3-2.

Thus I tried instead to compile from source, and succeeded both for verison 0.7.3 and 0.7.5 with these commands:

# install prerequisites
# (from https://github.com/zfsonlinux/zfs/wiki/Building-ZFS for Debian)
aptitude install build-essential autoconf libtool gawk alien fakeroot linux-headers-$(uname -r)
aptitude install zlib1g-dev uuid-dev libattr1-dev libblkid-dev libselinux-dev libudev-dev libssl-dev
aptitude install parted lsscsi ksh

# download source
# (URLs from from http://zfsonlinux.org)
cd /usr/local/src
version=0.7.5
wget https://github.com/zfsonlinux/zfs/releases/download/zfs-$version/spl-$version.tar.gz
wget https://github.com/zfsonlinux/zfs/releases/download/zfs-$version/zfs-$version.tar.gz
zcat spl-$version.tar.gz | tar xf -
zcat zfs-$version.tar.gz | tar xf -

# build spl
cd /usr/local/src/spl-$version
sh autogen.sh
./configure
make -s -j$(nproc)
make deb

# build zfs
cd /usr/local/src/zfs-$version
sh autogen.sh
./configure --with-spl=/usr/local/src/spl-$version
make -s -j$(nproc)
make deb

Install:

# install
cd /usr/local/src
dpkg -i spl-$version/spl_$version-1_amd64.deb
dpkg -i spl-$version/kmod-spl-$(uname -r)_0.7.5-1_amd64.deb
dpkg -i zfs-$version/zfs_$version-1_amd64.deb
dpkg -i zfs-$version/kmod-zfs-$(uname -r)_0.7.5-1_amd64.deb
dpkg -i zfs-$version/libnvpair1_$version-1_amd64.deb
dpkg -i zfs-$version/libuutil1_$version-1_amd64.deb
dpkg -i zfs-$version/libzpool2_$version-1_amd64.deb
dpkg -i zfs-$version/libzfs2_$version-1_amd64.deb

# load modules once (or simply "modprobe zfs"?)
cd /usr/local/src/zfs-$version/scripts
bash zfs.sh

# automate loading of modules on each reboot
# (from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=826994#30)
update-rc.d zfs-import defaults
update-rc.d zfs-mount defaults
update-rc.d zfs-zed defaults   # optional
update-rc.d zfs-share defaults # optional

Update:

If you install a new kernel, you must reinstall linux-headers-$(uname -r), and uninstall, recompile and reinstall both spl and zfs.
For compilation use the same commands as for building them whown above, except also run "make clean" before "./configure".

Test:

mkdir /scratch
for i in {1..3}; do truncate -s 2G /scratch/$i.img; done
zpool create zpool raidz1 /scratch/{1..3}.img
zpool list
zpool status
zfs list

Looks good so far. Even /etc/zfs/vdev_id.conf works (after udevadm trigger).


Updates:
2017-12-29
version 0.7.3 hardcoded → $version 0.7.5 variable
added dpkg -i kmod-spl & kmod-zfs
added update-rc.d commands

Impressum