This is an old revision of the document!
Install arch linux with zfs root
- Obtain latest ISO from archlinux.org and burn it to an ISO
- Boot up and change / size \
- mount a swap partition
- mount -o remount,size=16G /run/archiso/cowspace
- Add zfs support
curl -s https://archzfs.leibelt.de/media/setup/init | bash
zgenhostid -f 0x00bab10c
- Partition Disk(s)
- Create EFI partition
sgdisk -n "1:1m:+512m" -t "1:ef00" /dev/sda
- I suggest a swap partition large enough to hold RAM (my system has 16g) contents if you intend to use hibernate
sgdisk -n "2:0:+16g" -t "2:8200" /dev/sda
- Allocate the remainder to the ZFS pool
sgdisk -n "3:0:-10m" -t "3:bf00" /dev/sda
- Create the ZFS pool
- I suggest using the partition UUID for the device name.
root@archiso ~ # ls -l /dev/disk/by-partuuid|grep sda3 lrwxrwxrwx 1 root root 10 Sep 2 10:21 1aea6cc8-8333-4d5c-a9e6-e0a51296391d -> ../../sda3
- We will be using zfsbootmenu which is currently using OpenZFS 2.3
zpool create -f -o ashift=12 \ -O compression=lz4 \ -O acltype=posixacl \ -O xattr=sa \ -O relatime=on \ -o autotrim=on \ -o compatibility=openzfs-2.3-linux \ -m none zroot /dev/disk/by-partuuid/1aea6cc8-8333-4d5c-a9e6-e0a51296391d
- Export / Import the ZFS pool
zpool export zroot && zpool import -NR /mnt zroot
- Create the ZFS file systems including the home directory for the normal user account.
zfs create -o mountpoint=none zroot/ROOT zfs create -o mountpoint=/ -o canmount=noauto zroot/ROOT/arch zfs mount zroot/ROOT/arch zfs create -o mountpoint=none zroot/homes zfs create -o mountpoint=/root zroot/homes/root zfs create -o mountpoint=/home/USER zroot/homes/USER zfs mount zroot/ROOT/arch /mnt zroot/homes/root /mnt/root zroot/homes/USER /mnt/home/USER
- Set up EFI and swap partitions
mkfs.vfat -F32 /dev/sda1 mkswap /dev/sda2
- Install the system
pacstrap /mnt linux linux-headers linux-firmware base vim amd-ucode networkmanager sudo openssh rsync
- Populate the fstab
echo "$(blkid /dev/sda1|cut -d\ -f2) /boot/efi vfat defaults 0 2" >> /mnt/etc/fstab echo "$(blkid /dev/sda2|cut -d\ -f2) none swap sw 0 0" >> /mnt/etc/fstab
- Move into the install
arch-chroot /mnt
- Set up arch system
- Time
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime hwclock --systohc
- locale
sed -i 's/#\(en_US\.UTF-8\)/\1/' /etc/locale.gen locale-gen echo "LANG=en_US.UTF-8" > /etc/locale.conf
- vconsole
echo -e "KEYMAP=us\n#FONT=latarcyrheb-sun32" > /etc/vconsole.conf
- hostname/hosts
echo tas > /etc/hostname
- set root password
passwd root
- Create a normal user and add to sudoers/wheel group
useradd -G wheel some_user passwd some_user
- edit sudoers with visudo to uncomment one of the wheel stanzas
EDITOR=vim visudo
- create home for some_user
mkdir -p ~some_user && chown some_user ~some_user
- su - some_user
- Install paru
sudo pacman -S --needed base-devel git git clone https://aur.archlinux.org/paru.git cd paru makepkg -si cd .. rm -rf .cargo/ paru/
- Install zfs support
paru -S zfs-utils paru -S zfs-dkms
- exit to root
- finish setup
zgenhostid -f 0x00bab10c
- edit /etc/mkinitcpio.conf and modify the HOOKS line
- remove fsck, add zfs resume
mkinitcpio -P
- set up services
systemctl disable zfs-import-cache.service systemctl mask zfs-import-cache.service systemctl enable zfs-import-scan.service zfs-mount.service zfs.target zfs-volumes.target zfs-import.target zfs-zed.service NetworkManager
