This is a tutorial for building and installing the latest release version (0.7.3 as of writing) of "ZFS on Linux" on a Raspberry Pi 3 running Raspbian Stretch. Specifically, we'll be building the dkms
version of ZoL, which saves you the hassle of re-compiling the kernel modules after every kernel update. Even though ZoL added support for building dkms packages for debian in version 0.7.3, the build process on a Raspberry Pi 3 is not quite straight-forward. Hopefully, these instructions will make it easier.
- Install the build dependencies.
$ sudo apt-get update
$ sudo apt-get install build-essential autoconf libtool gawk alien fakeroot
$ sudo apt-get install dkms zlib1g-dev uuid-dev libattr1-dev libblkid-dev libselinux-dev libudev-dev libssl-dev parted lsscsi wget ksh
You'll also need the kernel headers. Running apt-get upgrade will take care of both installation and upgradation.
$ sudo apt-get upgrade raspberrypi-kernel raspberrypi-kernel-headers
- Download the source.
Download the latest release tarballs for zfs and spl from this page and extract them.
$ wget https://github.com/zfsonlinux/zfs/releases/download/zfs-0.7.3/spl-0.7.3.tar.gz && tar -xzf spl-0.7.3.tar.gz
$ wget https://github.com/zfsonlinux/zfs/releases/download/zfs-0.7.3/zfs-0.7.3.tar.gz && tar -xzf zfs-0.7.3.tar.gz
- Compile and install spl.
$ cd spl-0.7.3/
$ autoreconf --install --force
$ ./configure
You need to make a small edit to the Makefile
generated by configure
before you proceed.
$ sed -E 's/(^RPMBUILD = rpmbuild.*)/\1 --target=armhf/' -i Makefile
$ make pkg-utils deb-dkms
$ for deb in *.deb; do sudo dpkg -i "$deb"; done
The final step will take some time as dkms builds spl modules for each kernel version installed in your system.
- Compile and install zfs.
The build process for zfs is the same as spl, albeit with an extra option --with-config=srpm
in ./configure
$ cd ../zfs-0.7.3/
$ autoreconf --install --force
$ ./configure --with-config=srpm
$ sed -E 's/(^RPMBUILD = rpmbuild.*)/\1 --target=armhf/' -i Makefile
$ make pkg-utils deb-dkms
$ for deb in *.deb; do sudo dpkg -i "$deb"; done
The zfs source is much bigger than spl's and hence the build time will also be much longer.
- Reboot and Enjoy. :)
- The ZoL Wiki
- rpdom on this thread
I'm having issues with the "make pkg-utils" part of this guide when running on raspbian 4.19.65-v7l+.
I've tried it with various versions of zfs, but it's always the same.
The error is:
`make install-data-hook
make[6]: Entering directory '/tmp/zfs-build-pi-MEDFVMSR/BUILD/zfs-0.8.1'
make[6]: Nothing to be done for 'install-data-hook'.
make[6]: Leaving directory '/tmp/zfs-build-pi-MEDFVMSR/BUILD/zfs-0.8.1'
make[5]: Leaving directory '/tmp/zfs-build-pi-MEDFVMSR/BUILD/zfs-0.8.1'
make[4]: Leaving directory '/tmp/zfs-build-pi-MEDFVMSR/BUILD/zfs-0.8.1'
make[3]: Leaving directory '/tmp/zfs-build-pi-MEDFVMSR/BUILD/zfs-0.8.1'
make[2]: Leaving directory '/tmp/zfs-build-pi-MEDFVMSR/BUILD/zfs-0.8.1'
Processing files: zfs-0.8.1-1.armv7hnl
error: File not found: /tmp/zfs-build-pi-MEDFVMSR/BUILDROOT/zfs-0.8.1-1.%{_arch}/sbin/*
error: File not found: /tmp/zfs-build-pi-MEDFVMSR/BUILDROOT/zfs-0.8.1-1.%{_arch}/usr/share/man/man1/*
error: File not found: /tmp/zfs-build-pi-MEDFVMSR/BUILDROOT/zfs-0.8.1-1.%{_arch}/usr/share/man/man5/*
error: File not found: /tmp/zfs-build-pi-MEDFVMSR/BUILDROOT/zfs-0.8.1-1.%{_arch}/usr/share/man/man8/*
error: File not found: /tmp/zfs-build-pi-MEDFVMSR/BUILDROOT/zfs-0.8.1-1.%{_arch}/lib/udev/rules.d/*
error: File not found: /tmp/zfs-build-pi-MEDFVMSR/BUILDROOT/zfs-0.8.1-1.%{_arch}/etc/init.d/*
error: File not found: /tmp/zfs-build-pi-MEDFVMSR/BUILDROOT/zfs-0.8.1-1.%{_arch}/etc/sudoers.d/*
RPM build errors:
File not found: /tmp/zfs-build-pi-MEDFVMSR/BUILDROOT/zfs-0.8.1-1.%{_arch}/sbin/*
File not found: /tmp/zfs-build-pi-MEDFVMSR/BUILDROOT/zfs-0.8.1-1.%{_arch}/usr/share/man/man1/*
File not found: /tmp/zfs-build-pi-MEDFVMSR/BUILDROOT/zfs-0.8.1-1.%{_arch}/usr/share/man/man5/*
File not found: /tmp/zfs-build-pi-MEDFVMSR/BUILDROOT/zfs-0.8.1-1.%{_arch}/usr/share/man/man8/*
File not found: /tmp/zfs-build-pi-MEDFVMSR/BUILDROOT/zfs-0.8.1-1.%{_arch}/lib/udev/rules.d/*
File not found: /tmp/zfs-build-pi-MEDFVMSR/BUILDROOT/zfs-0.8.1-1.%{_arch}/etc/init.d/*
File not found: /tmp/zfs-build-pi-MEDFVMSR/BUILDROOT/zfs-0.8.1-1.%{_arch}/etc/sudoers.d/*
make[1]: *** [Makefile:1234: rpm-common] Error 1
make[1]: Leaving directory '/home/pi/zfs/zfs-0.8.1'
make: *** [Makefile:1193: rpm-utils] Error 2
`
When I try the same on an x86 box, the path turns out to be
/tmp/zfs-build-ubuntu-89OPc67R/BUILDROOT/zfs-0.8.1-1.x86_64
It looks as if the system architecture isn't recognized. But I'm not familiar enough with make and package building to figure this out on my own. Any help appreciated.