ayufan-rock64 / linux-build

Rock64 Linux build scripts, tools and instructions
MIT License
561 stars 98 forks source link

ZFS on Rockpro64 #423

Open vinistoisr opened 4 years ago

vinistoisr commented 4 years ago

ZFS won't install. Forums, github, blog posts are a mess on this issue.

Does ZFS work or not, and if so, how to install it?

caewok commented 4 years ago

Yes, ZFS works. I have been running it for more than a year now on two Rockpro64s. I am using Linux rockpro64 4.20.0-1083-ayufan-g686e1f1aa461 and Ubuntu 18.04 (Bionic LTS). Let me know if you run it using Ubuntu 20.04 (haven't tried yet).

First, make sure you have all of the following installed:

sudo apt update && sudo apt upgrade
sudo apt install -y \
  build-essential \
  make \
  autogen \
  autoconf \
  libtool \
  libtool-bin \
  libkmod-dev \
  gawk \
  alien \
  fakeroot \
  curl \
  wget \
  flex \
  bison \
  dkms \
  zlib1g-dev \
  uuid-dev \
  libattr1-dev \
  libblkid-dev \
  libselinux-dev \
  libudev-dev \
  parted \
  lsscsi \
  ksh \
  libssl-dev \
  libelf-dev \
  gdb \
  python3-distutils \
  nfs-kernel-server \
  open-iscsi \
  watchdog \
  xattr \
  samba \
  samba-client \
  acl \
  smartmontools \
  mailutils

Second, install SPL. I first tried with SPL 0.7.8, but there was an issue with the time function. Version 0.7.12-1 worked for me.

git clone https://github.com/zfsonlinux/spl
cd spl
git checkout spl-0.7.12
sudo autoreconf --install --force
sudo ./configure

Edit the makefile with the processor target: result of uname -m, which should be aarch64 for RockPro64.

sudo sed -E 's/(^RPMBUILD = rpmbuild.*)/\1 --target=aarch64/' -i Makefile
sudo make -s -j$(nproc)
sudo make install

Third, install zfs. I installed 0.8.0-rc3_38_g57dc41de9. This was, as I said, about a year ago; you may want to use a newer version.

git clone https://github.com/zfsonlinux/zfs
cd zfs
sudo autoreconf --install --force
sudo ./configure
sudo sed -E 's/(^RPMBUILD = rpmbuild.*)/\1 --target=aarch64/' -i Makefile
sudo make -s -j$(nproc)
sudo make install

Edit /etc/ld.so.conf to include /usr/local/lib. Add the following:

include /etc/ld.so.conf.d/*.conf
/usr/local/lib

Add zfs module to boot:

sudo su
echo zfs >> /etc/modules
exit

Reboot sudo reboot now

On reboot, zpool status should return "no pools available" (unless of course you imported pools) sudo zpool status

You can run tests using zloop script (-t for time in seconds, otherwise will run indefinitely). Wherever you saved the zfs source, look to run scripts/zloop.sh -t 600.

I have not managed to get the pool to mount during boot process, but otherwise I have not seen any issues. My pool is a relatively simple mirror, so YMMV for more complicated setups.

GoofyAF commented 2 years ago

Hi, thanks for the guide.

I have a rockpro64 and am running Armbian based on Ubuntu 18.04.6 LTS. This is because I've had trouble booting more modern kernels for this board.

I followed along until

git clone https://github.com/zfsonlinux/spl
cd spl
git checkout spl-0.7.12
sudo autoreconf --install --force
sudo ./configure

The last command, sudo ./configure gives me the following output:

configure: error: 
    *** Please make sure the kernel devel package for your distribution
    *** is installed and then try again.  If that fails, you can specify the
    *** location of the kernel source with the '--with-linux=PATH' option.

Using apt search doesn't seem to provide a devel kernel package. Do you have any thoughts on this error?