Skip to content

Instantly share code, notes, and snippets.

@ColonelBundy
Created June 28, 2017 00:34
Show Gist options
  • Save ColonelBundy/93e7f0aa01c18e53bbda31d267064639 to your computer and use it in GitHub Desktop.
Save ColonelBundy/93e7f0aa01c18e53bbda31d267064639 to your computer and use it in GitHub Desktop.
Scaleway ZFS Ubuntu Install - kernel 4.9.20-sda1
# Determine versions
arch="$(uname -m)"
release="$(uname -r)"
upstream="${release%%-*}"
local="${release#*-}"
# Get kernel sources
mkdir -p /usr/src
wget -O "/usr/src/linux-${upstream}.tar.xz" "https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-${upstream}.tar.xz"
tar xf "/usr/src/linux-${upstream}.tar.xz" -C /usr/src/
ln -fns "/usr/src/linux-${upstream}" /usr/src/linux
ln -fns "/usr/src/linux-${upstream}" "/lib/modules/${release}/build"
# Prepare kernel
zcat /proc/config.gz > /usr/src/linux/.config
printf 'CONFIG_LOCALVERSION="%s"\nCONFIG_CROSS_COMPILE=""\n' "${local:+-$local}" >> /usr/src/linux/.config
wget -O /usr/src/linux/Module.symvers "http://mirror.scaleway.com/kernel/${arch}/${release}/Module.symvers"
apt-get install -y libssl-dev # adapt to your package manager
make -C /usr/src/linux prepare modules_prepare
# Credits: https://blog.simos.info/tag/scaleway/ (do not use his, its broken)
# Now, let's grab the latest spl and zfs (see http://zfsonlinux.org/).
cd /usr/src/
wget https://github.com/zfsonlinux/zfs/releases/download/zfs-0.6.5.9/spl-0.6.5.9.tar.gz
wget https://github.com/zfsonlinux/zfs/releases/download/zfs-0.6.5.9/zfs-0.6.5.9.tar.gz
# Install some dev packages that are needed for spl and zfs,
apt install -y uuid-dev
apt install -y dh-autoreconf
# Let's do spl first
tar xvfa spl-0.6.5.9.tar.gz
cd spl-0.6.5.9/
./autogen.sh
./configure # Takes about 2 minutes
make # Takes about 1:10 minutes
make install
cd ..
# Let's do zfs next
cd zfs-0.6.5.9/
tar xvfa zfs-0.6.5.9.tar.gz
./autogen.sh
./configure # Takes about 6:10 minutes
make # Takes about 13:20 minutes
make install
# Let's get ZFS loaded
depmod -a
ldconfig
modprobe zfs
zfs list
zpool list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment