Skip to content

Instantly share code, notes, and snippets.

@awehrfritz
Last active January 29, 2020 00:25
Show Gist options
  • Save awehrfritz/533dcc6cb59ef8f753b1840fdaeef9aa to your computer and use it in GitHub Desktop.
Save awehrfritz/533dcc6cb59ef8f753b1840fdaeef9aa to your computer and use it in GitHub Desktop.
Install ZFS on Helios4 NAS
#!/usr/bin/env bash
#
# Installation script for ZFS on Armbian for Helios4, a Marvell Armada 388 SoC
# with a ARM Cortex-A9 (ARMv7 32-bit) CPU, 2 GB ECC RAM and up to 4 disks.
#
# Tested on Armbian 19.11.3 (Debian Buster) with Linux 4.19.84
# (linux-image-current-mvebu) and ZFS version 0.7.12.
apt-get update
apt-get --yes upgrade
# Workaround for failing dkms builds
[[ -f /etc/environment ]] && [[ $(grep -c ARCH /etc/environment) -gt 0 ]] && mv /etc/environment /etc/environment.bak
# Ensure some essential build dependencies are installed
apt-get --yes install build-essential make autogen autoconf libtool
# Check that the correct kernel is installed
KERNEL_VER=current-mvebu
dpkg -l linux-image-${KERNEL_VER}
[[ $? -ne 0 ]] && echo "linux-image-${KERNEL_VER} not installed... Exit" && exit 1
# Check if kernel headers are installed; install if not and reboot
dpkg -l linux-headers-${KERNEL_VER}
[[ $? -ne 0 ]] && apt-get --yes install linux-headers-${KERNEL_VER} && reboot
# Install ZFS
apt-get --yes install spl-dkms zfs-dkms
systemctl daemon-reload
modprobe zfs
apt-get --yes install zfsutils-linux
# Install NFS and SMB servers
nfs_smb=y
while true; do
echo "Install NFS and SMB servers [Y/n]?"
read nfs_smb
if [[ "$nfs_smb" == *"y"* || "$nfs_smb" == *"Y"* || -z $nfs_smb ]]; then
apt-get --yes install nfs-kernel-server
apt-get --yes install samba
break
elif [[ "$nfs_smb" == *"n"* ]]; then
break
fi
done
# Reboot
proceed=y
while true; do
echo "Reboot system now [Y/n]?"
read proceed
[[ "$proceed" == *"y"* || "$proceed" == *"Y"* || -z $proceed ]] && break
[[ "$proceed" == *"n"* ]] && exit 0
done
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment