Skip to content

Prepare system

unicorn edited this page May 14, 2021 · 1 revision

generate a fstab with genfstab -U -p /mnt >> /mnt/etc/fstab and edit it to exclude the all zfs datasets (should only contain efi partition) by commenting them out, the lines to comment out are most likely:

zroot/ROOT/default
zroot/data/home
zroot/data/home/root

chroot into the new system with arch-chroot /mnt.

now follow the instructions to add the arch-zfs repo to pacman. Do it by adding

[archzfs]
Server = https://archzfs.com/$repo/$arch

to the pacman.conf. Then if the versions of archzfs and linux match just type pacman -S linux archzfs-linux. Should the key import fail download the key with curl --remote-name https://archzfs.com/archzfs.gpg and add it to the keychain with pacman-key -a archzfs.gpg then sign it with pacman-key --lsign-key DDF7DB817396A49B2A2723F7403BD972F75D9D76 you may also delete the keyfile again with rm -f archzfs.gpg

If they don't match add the end.re repo if you don't want to manually install the right kernel version but keep in mind that this repo isn't official, so use with care.

generate an appropriate host id with: zgenhostid $(hostid) and create a zfs cache file with zpool set cachefile=/etc/zfs/zpool.cache zroot. Your system won't boot if you forget this step.

modify the kernel hooks in /etc/mkinitcpio.conf to HOOKS=(base udev autodetect modconf block keyboard zfs filesystems), that means adding zfs in front of filesystems and moving keyboard in front of both. You may optionally also remove fsck, as it's not needed when the root is on a zfs filesystem. Then generate the new hooks with mkinitcpio -p KERNEL where kernel is the name of your kernel, in most cases linux.

Also enable these services zfs.target, zfs-import-cache, zfs-mount, zfs-import.target with these commands

systemctl enable zfs.target
systemctl enable zfs-import-cache
systemctl enable zfs-mount
systemctl enable zfs-import.target
Clone this wiki locally