- timmawhinney
- Posts: 13
- Joined: Sat Dec 10, 2022 9:19 am
ZFS root filesystem on RaspberryPi4/CM4 stable
Gentoo linux will boot into a ZFS rootfilesystem on a raspberrypi 4 and CM4. Initial impression is that it is stable and some operations are extremely quick. The ZFS root is compressed with lz4 and I currently get a 1.45x compression ratio. The hdparm reported buffered read speed is 356Mb/s which is that maximum I could obtain on my CM4 developer board using a PCIe connected SSD.
Key steps include recompiling the RaspberryPi kernel 5.15 with the ZFS modules built in (currently 2.19) in Gentoo. Then using genkernel to create a ZFS compatible initramfs.
I got lost trying to get UEFI, U-Boot and GRUB to work together, but they are not necessary. If you copy the kernel image with ZFS built-in and the initramfs to the boot partition and alter the config.txt and cmdline appropriately the GPU bootloader works great.
I am going to try and adding multiple devices to see if that breaks things! ZFS advantages include compression and integrity and the performance on the Pi4 and CM4 is excellent.
Key steps include recompiling the RaspberryPi kernel 5.15 with the ZFS modules built in (currently 2.19) in Gentoo. Then using genkernel to create a ZFS compatible initramfs.
I got lost trying to get UEFI, U-Boot and GRUB to work together, but they are not necessary. If you copy the kernel image with ZFS built-in and the initramfs to the boot partition and alter the config.txt and cmdline appropriately the GPU bootloader works great.
I am going to try and adding multiple devices to see if that breaks things! ZFS advantages include compression and integrity and the performance on the Pi4 and CM4 is excellent.
- timmawhinney
- Posts: 13
- Joined: Sat Dec 10, 2022 9:19 am
Re: ZFS root filesystem on RaspberryPi4/CM4 stable
Multiple devices works too with the expectant speed increase. 270Mb/s over USB with zstd-9 stripped RAID 0 (ZFS). LZ4 compression seems to be much quicker than zstd on the Pi but as expected the compression ration with zstd-9 is better 1.72x
Re: ZFS root filesystem on RaspberryPi4/CM4 stable
My current route is FreeBSD with a pre-built image avoiding the fragile compiling hassle: The ZFS filesystem via FreeBSD on a Raspberry Pi: A private backup server
There is a recommendation not to use ZFS on Linux (ZoL):
There is a recommendation not to use ZFS on Linux (ZoL):
However, I don't have details on that.
Re: ZFS root filesystem on RaspberryPi4/CM4 stable
That is a quote about running ZFS on legacy x86 systems, not ARM or even Raspberry Pi. I don't understand why ZFS working well on x86 versions of FreeBSD in any way recommends against using ZFS in Linux on a Pi.
Re: ZFS root filesystem on RaspberryPi4/CM4 stable
It's about software, not hardware, see the update here: viewtopic.php?p=2089553#p2089553
- timmawhinney
- Posts: 13
- Joined: Sat Dec 10, 2022 9:19 am
Re: ZFS root filesystem on RaspberryPi4/CM4 stable
Thanks for the info.
I have tried ZFS root with FreeBSD on the Pi and it's excellent.
The problem I had with FreeBSD was getting the GPU working with MESA and Wayland - how did you accomplish this?
With Gentoo/ZoL I have a completely customised OS with the advantages of ZFS and native GPU support with Wayland and no screen tearing. It's odd but I always find the response time and interface much better than with Raspberry Pi OS and that's on a 4K display!
I have tried ZFS root with FreeBSD on the Pi and it's excellent.
The problem I had with FreeBSD was getting the GPU working with MESA and Wayland - how did you accomplish this?
With Gentoo/ZoL I have a completely customised OS with the advantages of ZFS and native GPU support with Wayland and no screen tearing. It's odd but I always find the response time and interface much better than with Raspberry Pi OS and that's on a 4K display!
Re: ZFS root filesystem on RaspberryPi4/CM4 stable
I was using my Raspberry Pi 3 Model B+ as a headless server only, so an SSH access was sufficient for me. No need to get the GPU working.timmawhinney wrote: ↑Sat Apr 01, 2023 8:24 amI have tried ZFS root with FreeBSD on the Pi and it's excellent.
The problem I had with FreeBSD was getting the GPU working with MESA and Wayland - how did you accomplish this?
However, due to USB issues on FreeBSD I gave up for now: viewtopic.php?p=2093171#p2093171
- timmawhinney
- Posts: 13
- Joined: Sat Dec 10, 2022 9:19 am
Re: ZFS root filesystem on RaspberryPi4/CM4 stable
I have used NVMe drives attached via PCIe on the CM4 developer board and NVMe drives attached via USB enclosures with no problem. ZFS also works with USB memory sticks - I don't think there is a need for ECC memory any more.
Re: ZFS root filesystem on RaspberryPi4/CM4 stable
My understanding is that the decision whether or not to use ECC memory with ZFS is based on the idea that the error rate during the scrub should be less then the error rate of the drives themselves.timmawhinney wrote: ↑Tue Apr 11, 2023 12:03 pmI have used NVMe drives attached via PCIe on the CM4 developer board and NVMe drives attached via USB enclosures with no problem. ZFS also works with USB memory sticks - I don't think there is a need for ECC memory any more.
Seen another way, if you have installed ZFS to detect silent data corruption on the drive, then you are likely interested in detecting silent data corruption in RAM.
Correcting such errors becomes a daily event with petabytes of storage but not so much for a Pi with few USB drives.
Re: ZFS root filesystem on RaspberryPi4/CM4 stable
There was a case where metadata was corrupted in memory before computing the checksum, such that the data wasn't accessible anymore (but scrub didn't return/correct any errors since the checksum made over the corrupted metadata block was correct):
"That said, bitflips can happen anywhere. One place that is interesting would be a buffer for a write before the checksum is done. That would cause bad data to be written with a good checksum and if it is metadata, then in an extreme case, a pool could become unimportable. This happened to one of the developers on his personal machine. He then debugged it, found the bitflip and wrote a custom tool to fix it."
https://github.com/openzfs/zfs/discussi ... nt-5279415
Jump to
- Community
- General discussion
- Announcements
- Other languages
- Deutsch
- Español
- Français
- Italiano
- Nederlands
- 日本語
- Polski
- Português
- Русский
- Türkçe
- User groups and events
- Raspberry Pi Official Magazine
- Using the Raspberry Pi
- Beginners
- Troubleshooting
- Advanced users
- Assistive technology and accessibility
- Education
- Picademy
- Teaching and learning resources
- Staffroom, classroom and projects
- Astro Pi
- Mathematica
- High Altitude Balloon
- Weather station
- Programming
- C/C++
- Java
- Python
- Scratch
- Other programming languages
- Windows 10 for IoT
- Wolfram Language
- Bare metal, Assembly language
- Graphics programming
- OpenGLES
- OpenVG
- OpenMAX
- General programming discussion
- Projects
- Networking and servers
- Automation, sensing and robotics
- Graphics, sound and multimedia
- Other projects
- Media centres
- Gaming
- AIY Projects
- Hardware and peripherals
- Camera board
- Compute Module
- Official Display
- HATs and other add-ons
- Device Tree
- Interfacing (DSI, CSI, I2C, etc.)
- Keyboard computers (400, 500, 500+)
- Raspberry Pi Pico
- General
- SDK
- MicroPython
- Other RP2040 boards
- Zephyr
- Rust
- AI Accelerator
- AI Camera - IMX500
- Hailo
- Software
- Raspberry Pi OS
- Raspberry Pi Connect
- Raspberry Pi Desktop for PC and Mac
- Beta testing
- Other
- Android
- Debian
- FreeBSD
- Gentoo
- Linux Kernel
- NetBSD
- openSUSE
- Plan 9
- Puppy
- Arch
- Pidora / Fedora
- RISCOS
- Ubuntu
- Ye Olde Pi Shoppe
- For sale
- Wanted
- Off topic
- Off topic discussion