hetzner-dedicated/zfs: Just use hetzner's way of installing zfs in rescue

This commit is contained in:
Akshay Mankar 2023-10-15 14:12:37 +02:00
parent 4ab3453177
commit 828541dcb3
Signed by: axeman
GPG key ID: CA08F3AB62369B89

View file

@ -27,32 +27,11 @@
# * exports of env vars are added throughout the script in case you want to run it manually
export LC_ALL=C
# ORIGINAL WARNING: on 2023/07/16 the rescue system of hetzner boots with kernel 6.3.7 which
# is by default not supported by the latest debian package. You need to update to debian
# unstable to proceed with the zfs installation.
# NEW WARNING: Upgrading to unstable is too much work, maybe just downloading zfs and building it is easier.
apt update
apt install -y dpkg-dev linux-headers-$(uname -r) linux-image-amd64 sudo parted zfsutils-linux libssl-dev uuid-dev zlib1g-dev libblkid-dev
set -euox pipefail
# TODO: This part is slow and not idempotent, so it needs to be commented out on
# subsequent runs
cd "$(mktemp -d)"
wget "$(curl -Ls https://api.github.com/repos/openzfs/zfs/releases/latest| grep -E "browser_download_url.*\.tar.gz\"$"| cut -d '"' -f 4)"
tar xfv zfs*.tar.gz && rm zfs*.tar.gz
cd zfs*
./configure && make -j "$(nproc)"
make install
ldconfig
modprobe zfs
# hetzner has some weird symlinks to make you install zfs with their script
rm /usr/local/sbin/zfs || true
rm /usr/local/sbin/zpool || true
# Inspect existing disks
# Should give you something like
# NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT