User Tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
computers:linux:arch-zfs-install [2025/08/29 21:00] wikiadmincomputers:linux:arch-zfs-install [2025/09/06 11:30] (current) wikiadmin
Line 1: Line 1:
-===== Install arch linux with zfs root =====+ ===== Install arch linux with zfs root ===== 
 + 
   - Obtain latest ISO from archlinux.org and burn it to an ISO   - Obtain latest ISO from archlinux.org and burn it to an ISO
   - Boot up and change / size  \     - Boot up and change / size  \  
Line 7: Line 9:
     - <code>curl -s https://archzfs.leibelt.de/media/setup/init | bash</code>     - <code>curl -s https://archzfs.leibelt.de/media/setup/init | bash</code>
     - <code>zgenhostid -f 0x00bab10c</code>     - <code>zgenhostid -f 0x00bab10c</code>
-  - Create zfs pool +  - Partition Disk(s) 
-  - Create file systems +    - Create EFI partition<code>sgdisk -n "1:1m:+512m" -t "1:ef00" /dev/sda</code> 
-  Export/Import pool and mount file systems +    I suggest a swap partition large enough to hold RAM (my system has 16g) contents if you intend to use hibernate<code>sgdisk -n "2:0:+16g" -t "2:8200" /dev/sda</code> 
-  Install the system +    - Allocate the remainder to the ZFS pool<code>sgdisk -n "3:0:-10m" -t "3:bf00" /dev/sda</code> 
-    - <code>pacstrap /mnt linux linux-headers linux-firmware base vim amd-ucode networkmanager sudo openssh rsync</code> +  - Create the ZFS pool 
-  - Create a normal user and add to sudoers/wheel group +    - I suggest using the partition UUID for the device name.<code> 
-    - useradd -G wheel some_user +root@archiso ~ # ls -l /dev/disk/by-partuuid|grep sda3  
-    passwd some_user +lrwxrwxrwx 1 root root 10 Sep  2 10:21 1aea6cc8-8333-4d5c-a9e6-e0a51296391d -> ../../sda3 
-    - visudo to allow wheel group to sudo +</code> 
-    - su some_user +    - We will be using [[https://zfsbootmenu.org|zfsbootmenu]] which is currently using OpenZFS 2.3<code> 
-  - Install paru +zpool create -f -o ashift=12 \ 
-    sudo pacman ---needed base-devel git + -O compression=lz4 \ 
-    - git clone https://aur.archlinux.org/paru.git + -O acltype=posixacl \ 
-    cd paru + -O xattr=sa \ 
-    makepkg -si + -O relatime=on \ 
-  Install zfs support + -o autotrim=on \ 
-    paru -S zfs-utils + -o compatibility=openzfs-2.3-linux \ 
-    paru -S zfs-dkms + -m none zroot /dev/disk/by-partuuid/1aea6cc8-8333-4d5c-a9e6-e0a51296391d 
-    exit to root +</code> 
-  - finish setup +  - Export / Import the ZFS pool<code>zpool export zroot && zpool import -NR /mnt zroot</code> 
-    - <code>zgenhostid -f 0x00bab10c</code> +  Create the ZFS file systems including the home directory for the normal user account.<code> 
-    edit /etc/mkinitcpio.conf +zfs create -o mountpoint=none zroot/ROOT 
-      remove fsck, add zfs resume +zfs create -o mountpoint=/ -o canmount=noauto zroot/ROOT/arch 
-      - <code>mkinitcpio -P</code> +zfs mount zroot/ROOT/arch 
-    set up services<code>systemctl disable zfs-import-cache.service + 
-systemctl mask zfs-import-cache.service +zfs mount 
-systemctl enable zfs-import-scan.service +zroot/ROOT/arch                 /mnt 
-systemctl enable zfs-mount.service +</code> 
-systemctl enable zfs.target +  Set up EFI and swap partitions<code> 
-systemctl enable zfs-volumes.target +mkfs.vfat -F32 /dev/sda1 
-systemctl enable zfs-import.target +mkswap /dev/sda2</code> 
-systemctl enable zfs-zed.service +  Install the system<code>pacstrap /mnt linux linux-headers linux-firmware base vim amd-ucode networkmanager sudo openssh rsync</code> 
-systemctl enable NetworkManager</code>+  Populate the fstab<code> 
 +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 defaults 0 0" >> /mnt/etc/fstab</code> 
 +  Move into the install 
 +    <code>arch-chroot /mnt</code> 
 +  - Set up arch system
     - Time<code>ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime     - Time<code>ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
 hwclock --systohc</code> hwclock --systohc</code>
Line 45: Line 52:
 locale-gen locale-gen
 echo "LANG=en_US.UTF-8" > /etc/locale.conf</code> echo "LANG=en_US.UTF-8" > /etc/locale.conf</code>
-    - set root password +    - vconsole<code>echo -e "KEYMAP=us\n#FONT=latarcyrheb-sun32" > /etc/vconsole.conf</code> 
-    - vconsole +    - hostname/hosts<code>echo tas > /etc/hostname</code> 
-      - <code>echo -e "KEYMAP=us\n#FONT=latarcyrheb-sun32" > /etc/vconsole.conf</code> +    - set root password<code>passwd root</code> 
-    - hostname/hosts +  - Create a normal user and add to sudoers/wheel group<code>useradd -G wheel some_user 
-      - <code>echo tas > /etc/hostname</code>+passwd some_user 
 +mkdir -p ~some_user && chown some_user ~some_user</code> 
 +    - edit sudoers with visudo to uncomment one of the wheel stanzas<code> 
 +EDITOR=vim visudo</code> 
 +    - create home for some_user<code>mkdir -p ~some_user && chown some_user ~some_user</code> 
 +    - su - some_user 
 +  - Install paru<code>sudo pacman -S --needed base-devel git 
 +git clone https://aur.archlinux.org/paru.git 
 +cd paru 
 +makepkg -si 
 +</code> 
 +  - Install zfs support<code>paru -S zfs-utils 
 +paru -S zfs-dkms 
 +</code> 
 +  - exit to root<code>exit</code> 
 +  - finish setup 
 +    - <code>zgenhostid -f 0x00bab10c</code> 
 +    - edit /etc/mkinitcpio.conf and modify the HOOKS line adding //resume// and //zfs//<code> 
 +vim /etc/mkinitcpio.conf 
 +grep ^HOOKS /etc/mkinitcpio.conf 
 +HOOKS=(base udev autodetect microcode modconf kms keyboard keymap zfs consolefont block filesystems resume) 
 +mkinitcpio -P</code> 
 +    - fix up user home directories<code>rm -rf ~some_user; mv /root /_root</code> 
 +    - set up services<code>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</code> 
 +  - Set up the EFI and install zfsbootmenu<code> 
 +zfs set org.zfsbootmenu:commandline="rw quiet" zroot/ROOT 
 +mkdir /boot/efi 
 +mount /boot/efi 
 +mkdir -p /boot/efi/EFI/ZBM 
 +curl -o /boot/efi/EFI/ZBM/VMLINUZ.EFI -L https://get.zfsbootmenu.org/efi 
 +cp /boot/efi/EFI/ZBM/VMLINUZ.EFI /boot/efi/EFI/ZBM/VMLINUZ-BACKUP.EFI 
 +pacman -S refind 
 +refind-install 
 +rm /boot/refind_linux.conf 
 +cat << EOF >> /boot/efi/EFI/refind/refind_linux.conf 
 + 
 +menuentry "zbm boot" { 
 +    loader /EFI/ZBM/VMLINUZ.EFI 
 +    options "quiet loglevel=0 zbm.skip" 
 +
 +menuentry "zbm menu" { 
 +    loader /EFI/ZBM/VMLINUZ.EFI 
 +    options "quiet loglevel=0 zbm.show" 
 +
 +menuentry "zbm backup menu" { 
 +    loader /EFI/ZBM/VMLINUZ-BACKUP.EFI 
 +    options "quiet loglevel=0 zbm.show" 
 +
 +EOF 
 +</code> 
 +  - Exit and reboot<code> 
 +exit 
 +umount -n -R /mnt 
 +zpool export zroot 
 +reboot 
 +</code> 
 +  - Finish up 
 +    - Log in as root<code> 
 +zfs create -o mountpoint=none zroot/homes 
 +zfs create -o mountpoint=/root zroot/homes/root 
 +zfs create -o mountpoint=/home/USER zroot/homes/USER 
 +cp -r /etc/skel/. ~ 
 +cp -r /etc/skel/. ~some_user 
 +chown -R some_user:some_user ~some_user 
 +chmod 750 ~some_user 
 +zfs snapshot zroot/ROOT/arch@initial 
 +exit 
 +</code> 

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also, you acknowledge that you have read and understand our Privacy Policy. If you do not agree, please leave the website.

More information