ZFS is one of the best server filesystems available, and DietPi is a nice server os for the SBCs, and I love the simplicity and efficacy of both.
Said that, I’m trying to understand how to configure ZFS support for DietPi, but up to now I just found people with problems or at best tentative solutions.
Is possible to utilize ZFS in DietPi? And in case, where to find proper DietPi documentation for it?
ZFS is a memory hog…it needs ALOT of RAM for caching
Here is a discussion about ZFS and memory usage…
Here is the FAQ’s directly from the OpenZFS website
https://openzfs.github.io/openzfs-docs/Project%20and%20Community/FAQ.html#hardware-requirements
Here is the installation page
https://openzfs.github.io/openzfs-docs/Getting%20Started/index.html
Worth checking “ZFS Common Myths” in the above link (FreeBSD forums)
As mentioned, ZFS requiring a lot of RAM is a false myth. It will use all the memory you give to it, but just for caching purposes (and good it does it)!
I didn’t go as little as the 256mb mentioned in the forum, but as personal experience I had it happily run on a laptop with 2gb. And now on my Raspbery 5 I have even more: 4gb.
I’m pretty sure it can run with any (reasonable) memory our modern SBC boards have: RAM is not a show stopper (and in case just for the very low end of the boards).
I think it should be given as a software option to enable (in my personal opinion a strongly suggested one to enable).
I am no expert on zfs (well, on anything to that matter). Spent time on perplexity.ai . Tried commands that I don’t fully understand but managed to build zfs on Radxa’s rock5b.
root@rock5b:~# uname -a
Linux rock5b 6.1.75-vendor-rk35xx #1 SMP Wed Oct 9 05:12:23 UTC 2024 aarch64 GNU/Linux
root@rock5b:~#
root@rock5b:~# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
root@rock5b:~#
root@rock5b:~# lsmod | grep zfs
zfs 2621440 2
zunicode 327680 1 zfs
zzstd 466944 1 zfs
zlua 139264 1 zfs
zcommon 69632 1 zfs
znvpair 61440 2 zfs,zcommon
zavl 16384 1 zfs
icp 208896 1 zfs
spl 73728 6 zfs,icp,zzstd,znvpair,zcommon,zavl
root@rock5b:~#
root@rock5b:~# zpool list
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
basepool 920G 1.02G 919G - - 0% 0% 1.00x ONLINE -
datapool 144G 194K 144G - - 0% 0% 1.00x ONLINE -
root@rock5b:~#
I first built zfs on my supermicro board running armbian. I then used the same commands to build it on rock5b. Here is it, for whatever it’s worth. Hope this helps in anyway.
Pre-req:
- Install linux kernel headers by the tool - armbian-config
\# apt update && apt upgrade -y
\# uname -a
Linux red-handsonbox 6.6.63-current-x86 #1 SMP PREEMPT_DYNAMIC Fri Nov 22 14:38:37 UTC 2024 x86_64 GNU/Linux
\# cat /etc/os-release
PRETTY_NAME="Armbian 24.11.1 bookworm"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.armbian.com"
SUPPORT_URL="https://forum.armbian.com"
BUG_REPORT_URL="https://www.armbian.com/bugs"
ARMBIAN_PRETTY_NAME="Armbian 24.11.1 bookworm"
\# apt install zfs-dkms zfsutils-linux
\# zpool list
The ZFS modules cannot be auto-loaded.
Try running 'modprobe zfs' as root to manually load them.
\# modprobe zfs
modprobe: FATAL: Module zfs not found in directory /lib/modules/6.6.63-current-x86
\# echo zfs | sudo tee -a /etc/initramfs-tools/modules
zfs
\# update-initramfs -u
update-initramfs: Generating /boot/initrd.img-6.6.63-current-x86
\# sync ; reboot
\# lsmod | grep zfs
\# modprobe zfs
modprobe: FATAL: Module zfs not found in directory /lib/modules/6.6.63-current-x86
\# dkms install zfs/$(apt-cache show zfs-dkms | grep Version | awk '{print $2}') -k $(uname -r)
Warning: I do not know how to handle 2.2.5-1~bpo12+1.
Warning: I do not know how to handle 2.2.4-1~bpo12+1.
Warning: I do not know how to handle 2.1.11-1.
Sign command: /lib/modules/6.6.63-current-x86/build/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub
Error! Could not find module source directory.
Directory: /usr/src/zfs-2.2.6-1~bpo12+3 does not exist.
\# curl -sS 'https://raw.githubusercontent.com/openzfs/zfs/master/META' | awk '$1 == "Linux-Maximum:" { print $2; exit }'
6.12
\# apt-cache showpkg linux-image-generic
Package: linux-image-generic
Versions:
Reverse Depends:
Dependencies:
Provides:
Reverse Provides:
linux-image-amd64 6.1.119-1 (= )
linux-image-amd64 6.11.5-1~bpo12+1 (= )
linux-image-amd64 6.1.115-1 (= )
\# dpkg-reconfigure zfs-dkms
Loading new zfs-2.2.5 DKMS files...
Building for 6.6.63-current-x86
Building initial module for 6.6.63-current-x86
Done.
zfs.ko:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/6.6.63-current-x86/updates/dkms/
spl.ko:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/6.6.63-current-x86/updates/dkms/
depmod......
\# modprobe zfs
\# lsmod | grep zfs
zfs 5447680 0
spl 102400 1 zfs
\# zpool list
no pools available
\# sync ; reboot
\# lsmod | grep zfs
zfs 5447680 6
spl 102400 1 zfs
\# modinfo zfs
filename: /lib/modules/6.6.63-current-x86/updates/dkms/zfs.ko
version: 2.2.5-1~bpo12+1
license: CDDL
license: Dual BSD/GPL
license: Dual MIT/GPL
author: OpenZFS
description: ZFS
alias: zzstd
alias: zcommon
alias: zunicode
alias: znvpair
alias: zlua
alias: icp
alias: zavl
alias: devname:zfs
alias: char-major-10-249
srcversion: CD3BA533EA2D844AED33219
depends: spl
retpoline: Y
name: zfs
vermagic: 6.6.63-current-x86 SMP preempt mod_unload modversions
I also understood that zfs on armbian is working, the point was if it is possible and how to get it working on dietpi, since there are good reasons to have at least this option
Should be similar to Armbian as both are Debian based systems
Unfortunately not.
~# uname -a
Linux jumpy5 6.6.62+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.62-1+rpt1 (2024-11-25) aarch64 GNU/Linux
~# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
~# apt install zfs-dkms zfsutils-linux
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
dkms dpkg-dev file libdpkg-perl libnvpair3linux libuutil3linux libzfs4linux libzpool5linux patch xz-utils
Suggested packages:
menu debian-keyring gnupg | sq | sqop | pgpainless-cli | sequoia-chameleon-gnupg bzr ed diffutils-doc debhelper nfs-kernel-server samba-common-bin zfs-initramfs | zfs-dracut
Recommended packages:
fakeroot build-essential gnupg | sq | sqop | pgpainless-cli | sequoia-chameleon-gnupg libalgorithm-merge-perl libfile-fcntllock-perl zfs-zed linux-libc-dev
The following NEW packages will be installed:
dkms dpkg-dev file libdpkg-perl libnvpair3linux libuutil3linux libzfs4linux libzpool5linux patch xz-utils zfs-dkms zfsutils-linux
0 upgraded, 12 newly installed, 0 to remove and 0 not upgraded.
Need to get 7140 kB of archives.
After this operation, 31.9 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 https://deb.debian.org/debian bookworm/main arm64 xz-utils arm64 5.4.1-0.2 [469 kB]
Get:2 https://archive.raspberrypi.com/debian bookworm/main arm64 libdpkg-perl all 1.22.6~bpo12+rpt3 [656 kB]
Get:3 https://deb.debian.org/debian bookworm/main arm64 patch arm64 2.7.6-7 [121 kB]
Get:4 https://deb.debian.org/debian bookworm/main arm64 dkms all 3.0.10-8+deb12u1 [48.7 kB]
Get:5 https://deb.debian.org/debian bookworm/main arm64 file arm64 1:5.44-3 [42.5 kB]
Get:6 https://archive.raspberrypi.com/debian bookworm/main arm64 dpkg-dev all 1.22.6~bpo12+rpt3 [1393 kB]
Get:7 https://archive.raspberrypi.com/debian bookworm/main arm64 libnvpair3linux arm64 2.2.3-1~bpo12+1~rpt1 [58.4 kB]
Get:8 https://archive.raspberrypi.com/debian bookworm/main arm64 libuutil3linux arm64 2.2.3-1~bpo12+1~rpt1 [50.9 kB]
Get:9 https://archive.raspberrypi.com/debian bookworm/main arm64 libzfs4linux arm64 2.2.3-1~bpo12+1~rpt1 [213 kB]
Get:10 https://archive.raspberrypi.com/debian bookworm/main arm64 libzpool5linux arm64 2.2.3-1~bpo12+1~rpt1 [1150 kB]
Get:11 https://archive.raspberrypi.com/debian bookworm/main arm64 zfsutils-linux arm64 2.2.3-1~bpo12+1~rpt1 [541 kB]
Get:12 https://archive.raspberrypi.com/debian bookworm/main arm64 zfs-dkms all 2.2.3-1~bpo12+1~rpt1 [2398 kB]
Fetched 7140 kB in 6s (1296 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libdpkg-perl.
(Reading database ... 65502 files and directories currently installed.)
Preparing to unpack .../00-libdpkg-perl_1.22.6~bpo12+rpt3_all.deb ...
Unpacking libdpkg-perl (1.22.6~bpo12+rpt3) ...
Selecting previously unselected package xz-utils.
Preparing to unpack .../01-xz-utils_5.4.1-0.2_arm64.deb ...
Unpacking xz-utils (5.4.1-0.2) ...
Selecting previously unselected package patch.
Preparing to unpack .../02-patch_2.7.6-7_arm64.deb ...
Unpacking patch (2.7.6-7) ...
Selecting previously unselected package dpkg-dev.
Preparing to unpack .../03-dpkg-dev_1.22.6~bpo12+rpt3_all.deb ...
Unpacking dpkg-dev (1.22.6~bpo12+rpt3) ...
Selecting previously unselected package dkms.
Preparing to unpack .../04-dkms_3.0.10-8+deb12u1_all.deb ...
Unpacking dkms (3.0.10-8+deb12u1) ...
Selecting previously unselected package libnvpair3linux.
Preparing to unpack .../05-libnvpair3linux_2.2.3-1~bpo12+1~rpt1_arm64.deb ...
Unpacking libnvpair3linux (2.2.3-1~bpo12+1~rpt1) ...
Selecting previously unselected package libuutil3linux.
Preparing to unpack .../06-libuutil3linux_2.2.3-1~bpo12+1~rpt1_arm64.deb ...
Unpacking libuutil3linux (2.2.3-1~bpo12+1~rpt1) ...
Selecting previously unselected package libzfs4linux.
Preparing to unpack .../07-libzfs4linux_2.2.3-1~bpo12+1~rpt1_arm64.deb ...
Unpacking libzfs4linux (2.2.3-1~bpo12+1~rpt1) ...
Selecting previously unselected package libzpool5linux.
Preparing to unpack .../08-libzpool5linux_2.2.3-1~bpo12+1~rpt1_arm64.deb ...
Unpacking libzpool5linux (2.2.3-1~bpo12+1~rpt1) ...
Selecting previously unselected package zfsutils-linux.
Preparing to unpack .../09-zfsutils-linux_2.2.3-1~bpo12+1~rpt1_arm64.deb ...
Unpacking zfsutils-linux (2.2.3-1~bpo12+1~rpt1) ...
Selecting previously unselected package file.
Preparing to unpack .../10-file_1%3a5.44-3_arm64.deb ...
Unpacking file (1:5.44-3) ...
Selecting previously unselected package zfs-dkms.
Preparing to unpack .../11-zfs-dkms_2.2.3-1~bpo12+1~rpt1_all.deb ...
Unpacking zfs-dkms (2.2.3-1~bpo12+1~rpt1) ...
Setting up libnvpair3linux (2.2.3-1~bpo12+1~rpt1) ...
Setting up file (1:5.44-3) ...
Setting up xz-utils (5.4.1-0.2) ...
update-alternatives: using /usr/bin/xz to provide /usr/bin/lzma (lzma) in auto mode
Setting up patch (2.7.6-7) ...
Setting up libdpkg-perl (1.22.6~bpo12+rpt3) ...
Setting up libuutil3linux (2.2.3-1~bpo12+1~rpt1) ...
Setting up libzpool5linux (2.2.3-1~bpo12+1~rpt1) ...
Setting up libzfs4linux (2.2.3-1~bpo12+1~rpt1) ...
Setting up dpkg-dev (1.22.6~bpo12+rpt3) ...
Setting up dkms (3.0.10-8+deb12u1) ...
Setting up zfsutils-linux (2.2.3-1~bpo12+1~rpt1) ...
modprobe: FATAL: Module zfs not found in directory /lib/modules/6.6.62+rpt-rpi-2712
zfs-import-scan.service is a disabled or a static unit, not starting it.
Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 145.
Setting up zfs-dkms (2.2.3-1~bpo12+1~rpt1) ...
Loading new zfs-2.2.3 DKMS files...
Building for 6.6.62+rpt-rpi-2712
Module build for kernel 6.6.62+rpt-rpi-2712 was skipped since the
kernel headers for this kernel do not seem to be installed.
Processing triggers for libc-bin (2.36-9+rpt2+deb12u9) ...
Processing triggers for tiny-initramfs (0.1-5) ...
~# apt install linux-headers-arm64
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
linux-headers-arm64 is already the newest version (6.1.119-1).
The following package was automatically installed and is no longer required:
tiny-initramfs-core
Use 'apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
~# zpool list
The ZFS modules cannot be auto-loaded.
Try running 'modprobe zfs' as root to manually load them.
~# modprobe zfs
modprobe: FATAL: Module zfs not found in directory /lib/modules/6.6.62+rpt-rpi-2712
~# echo zfs | sudo tee -a /etc/initramfs-tools/modules
tee: /etc/initramfs-tools/modules: No such file or directory
zfs
~# update-initramfs -u
-bash: update-initramfs: command not found
~# apt install zfs-initramfs
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following package was automatically installed and is no longer required:
tiny-initramfs-core
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
busybox-static initramfs-tools initramfs-tools-core klibc-utils libklibc
Recommended packages:
zstd
The following packages will be REMOVED:
tiny-initramfs
The following NEW packages will be installed:
busybox-static initramfs-tools initramfs-tools-core klibc-utils libklibc zfs-initramfs
0 upgraded, 6 newly installed, 1 to remove and 0 not upgraded.
Need to get 1073 kB of archives.
After this operation, 5036 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 https://deb.debian.org/debian bookworm/main arm64 libklibc arm64 2.0.12-1 [46.0 kB]
Get:2 https://deb.debian.org/debian bookworm/main arm64 klibc-utils arm64 2.0.12-1 [101 kB]
Get:3 https://deb.debian.org/debian bookworm/main arm64 busybox-static arm64 1:1.35.0-4+b3 [819 kB]
Get:4 https://archive.raspberrypi.com/debian bookworm/main arm64 initramfs-tools-core all 0.142+rpt2+deb12u1 [53.1 kB]
Get:5 https://archive.raspberrypi.com/debian bookworm/main arm64 initramfs-tools all 0.142+rpt2+deb12u1 [17.1 kB]
Get:6 https://archive.raspberrypi.com/debian bookworm/main arm64 zfs-initramfs all 2.2.3-1~bpo12+1~rpt1 [35.6 kB]
Fetched 1073 kB in 1s (1196 kB/s)
Selecting previously unselected package libklibc:arm64.
(Reading database ... 67569 files and directories currently installed.)
Preparing to unpack .../libklibc_2.0.12-1_arm64.deb ...
Unpacking libklibc:arm64 (2.0.12-1) ...
Selecting previously unselected package klibc-utils.
Preparing to unpack .../klibc-utils_2.0.12-1_arm64.deb ...
Unpacking klibc-utils (2.0.12-1) ...
Selecting previously unselected package initramfs-tools-core.
Preparing to unpack .../initramfs-tools-core_0.142+rpt2+deb12u1_all.deb ...
Unpacking initramfs-tools-core (0.142+rpt2+deb12u1) ...
dpkg: tiny-initramfs: dependency problems, but removing anyway as you requested:
linux-image-6.6.62+rpt-rpi-2712 depends on initramfs-tools (>= 0.120+deb8u2) | linux-initramfs-tool; however:
Package initramfs-tools is not installed.
Package linux-initramfs-tool is not installed.
Package tiny-initramfs which provides linux-initramfs-tool is to be removed.
(Reading database ... 67672 files and directories currently installed.)
Removing tiny-initramfs (0.1-5) ...
Selecting previously unselected package initramfs-tools.
(Reading database ... 67665 files and directories currently installed.)
Preparing to unpack .../initramfs-tools_0.142+rpt2+deb12u1_all.deb ...
Unpacking initramfs-tools (0.142+rpt2+deb12u1) ...
Selecting previously unselected package busybox-static.
Preparing to unpack .../busybox-static_1%3a1.35.0-4+b3_arm64.deb ...
Unpacking busybox-static (1:1.35.0-4+b3) ...
Selecting previously unselected package zfs-initramfs.
Preparing to unpack .../zfs-initramfs_2.2.3-1~bpo12+1~rpt1_all.deb ...
Unpacking zfs-initramfs (2.2.3-1~bpo12+1~rpt1) ...
Setting up libklibc:arm64 (2.0.12-1) ...
Setting up busybox-static (1:1.35.0-4+b3) ...
Setting up klibc-utils (2.0.12-1) ...
No diversion 'diversion of /usr/share/initramfs-tools/hooks/klibc to /usr/share/initramfs-tools/hooks/klibc^i-t by klibc-utils', none removed.
Setting up initramfs-tools-core (0.142+rpt2+deb12u1) ...
Setting up initramfs-tools (0.142+rpt2+deb12u1) ...
update-initramfs: deferring update (trigger activated)
Setting up zfs-initramfs (2.2.3-1~bpo12+1~rpt1) ...
Processing triggers for initramfs-tools (0.142+rpt2+deb12u1) ...
update-initramfs: Generating /boot/initrd.img-6.6.62+rpt-rpi-2712
W: No zstd in /usr/bin:/sbin:/bin, using gzip
'/boot/initrd.img-6.6.62+rpt-rpi-2712' -> '/boot/firmware/initramfs_2712'
~# update-initramfs -u
update-initramfs: Generating /boot/initrd.img-6.6.62+rpt-rpi-2712
W: No zstd in /usr/bin:/sbin:/bin, using gzip
'/boot/initrd.img-6.6.62+rpt-rpi-2712' -> '/boot/firmware/initramfs_2712'
~# sync ; reboot
~# lsmod | grep zfs
~# modprobe zfs
modprobe: FATAL: Module zfs not found in directory /lib/modules/6.6.62+rpt-rpi-2712
~# dkms install zfs/$(apt-cache show zfs-dkms | grep Version | awk '{print $2}') -k $(uname -r)
Warning: I do not know how to handle 2.2.3-1~bpo12+1~rpt1.
Warning: I do not know how to handle 2.1.11-1.
Sign command: /lib/modules/6.6.62+rpt-rpi-2712/build/scripts/sign-file
Binary /lib/modules/6.6.62+rpt-rpi-2712/build/scripts/sign-file not found, modules won't be signed
Error! Could not find module source directory.
Directory: /usr/src/zfs-2.2.6-1~bpo12+3 does not exist.
~# curl -sS 'https://raw.githubusercontent.com/openzfs/zfs/master/META' | awk '$1 == "Linux-Maximum:" { print $2; exit }'
6.12
~# apt-cache showpkg linux-image-generic
Package: linux-image-generic
Versions:
Reverse Depends:
Dependencies:
Provides:
Reverse Provides:
linux-image-arm64 6.11.5-1~bpo12+1 (= )
linux-image-arm64 6.1.119-1 (= )
linux-image-arm64 6.1.115-1 (= )
~# dpkg-reconfigure zfs-dkms
Deleting module zfs-2.2.3 completely from the DKMS tree.
Loading new zfs-2.2.3 DKMS files...
Building for 6.6.62+rpt-rpi-2712
Module build for kernel 6.6.62+rpt-rpi-2712 was skipped since the
kernel headers for this kernel do not seem to be installed.
You are missing kernel headers, instead of linux-headers-arm64
try to install linux-headers-rpi-2712
sudo apt install linux-headers-rpi-2712
When installing kernel headers, always check the name of the actually installed kernel package. The matching headers package has the same name pattern. Else you pull headers for the Debian kernel, which is used only on x86 systems.
WORKED! thank you!
how to check what to check in names? E.g. 2712 doesn’t tell me anything…
Raspberry Pi 5 features the Broadcom BCM2712 quad-core Arm Cortex A76 processor @ 2.4GHz
Compare also with the kernel that is used on your system:
uname -a
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.