diff --git a/docs/Getting Started/Arch Linux/Root on ZFS/1-preparation.rst b/docs/Getting Started/Arch Linux/Root on ZFS/1-preparation.rst index 382c31c..959de69 100644 --- a/docs/Getting Started/Arch Linux/Root on ZFS/1-preparation.rst +++ b/docs/Getting Started/Arch Linux/Root on ZFS/1-preparation.rst @@ -104,6 +104,24 @@ Preparation INST_VDEV= + This will create a single vdev with the topology of your choice. + It is also possible to manually create a pool with multiple vdevs, such as:: + + zpool create --options \ + poolName \ + mirror sda sdb \ + raidz2 sdc ... \ + raidz3 sde ... \ + spare sdf ... + + Notice the cost of parity when using RAID-Z. See + `here `__ + and `here `__. + + Refer to `zpoolconcepts `__ + and `zpool-create `__ + man pages for details. + #. Set partition size: Set ESP size. ESP contains Live ISO for recovery, diff --git a/docs/Getting Started/Arch Linux/Root on ZFS/3-system-configuration.rst b/docs/Getting Started/Arch Linux/Root on ZFS/3-system-configuration.rst index 8dcef7b..98de035 100644 --- a/docs/Getting Started/Arch Linux/Root on ZFS/3-system-configuration.rst +++ b/docs/Getting Started/Arch Linux/Root on ZFS/3-system-configuration.rst @@ -92,6 +92,10 @@ System Configuration arch-chroot /mnt passwd +#. Generate host id:: + + zgenhostid -f -o /mnt/etc/hostid + #. Ignore kernel updates:: sed -i 's/#IgnorePkg/IgnorePkg/' /mnt/etc/pacman.conf diff --git a/docs/Getting Started/Arch Linux/Root on ZFS/5-bootloader.rst b/docs/Getting Started/Arch Linux/Root on ZFS/5-bootloader.rst index fa01a3a..c06dd2b 100644 --- a/docs/Getting Started/Arch Linux/Root on ZFS/5-bootloader.rst +++ b/docs/Getting Started/Arch Linux/Root on ZFS/5-bootloader.rst @@ -50,9 +50,6 @@ Install GRUB mkinitcpio -P -#. When in doubt, install both legacy boot - and EFI. - #. Create GRUB boot directory, in ESP and boot pool:: mkdir -p /boot/efi/EFI/arch @@ -61,6 +58,9 @@ Install GRUB Boot environment-specific configuration (kernel, etc) is stored in ``/boot/grub/grub.cfg``, enabling rollback. +#. When in doubt, install both legacy boot + and EFI. + #. If using legacy booting, install GRUB to every disk:: for i in ${DISK[@]}; do diff --git a/docs/Getting Started/Fedora/Root on ZFS/1-preparation.rst b/docs/Getting Started/Fedora/Root on ZFS/1-preparation.rst index 7af84ee..2333717 100644 --- a/docs/Getting Started/Fedora/Root on ZFS/1-preparation.rst +++ b/docs/Getting Started/Fedora/Root on ZFS/1-preparation.rst @@ -43,7 +43,7 @@ Preparation #. Install helper script and partition tool:: - dnf install -y arch-install-scripts gdisk + dnf install -y arch-install-scripts gdisk dosfstools #. Target Fedora version:: @@ -94,6 +94,24 @@ Preparation INST_VDEV= + This will create a single vdev with the topology of your choice. + It is also possible to manually create a pool with multiple vdevs, such as:: + + zpool create --options \ + poolName \ + mirror sda sdb \ + raidz2 sdc ... \ + raidz3 sde ... \ + spare sdf ... + + Notice the cost of parity when using RAID-Z. See + `here `__ + and `here `__. + + Refer to `zpoolconcepts `__ + and `zpool-create `__ + man pages for details. + #. Set partition size: Set ESP size:: diff --git a/docs/Getting Started/Fedora/Root on ZFS/3-system-configuration.rst b/docs/Getting Started/Fedora/Root on ZFS/3-system-configuration.rst index fc95d63..a42d623 100644 --- a/docs/Getting Started/Fedora/Root on ZFS/3-system-configuration.rst +++ b/docs/Getting Started/Fedora/Root on ZFS/3-system-configuration.rst @@ -81,6 +81,10 @@ System Configuration ``systemd-firstboot`` have bugs, root password is set below. +#. Generate host id:: + + zgenhostid -f -o /mnt/etc/hostid + #. Install locale package, example for English locale:: dnf --installroot=/mnt install -y glibc-minimal-langpack glibc-langpack-en @@ -95,6 +99,7 @@ System Configuration disable SSH server:: systemctl disable sshd --root=/mnt + systemctl enable firewalld --root=/mnt #. Chroot:: @@ -102,16 +107,16 @@ System Configuration INST_LINVAR=$INST_LINVAR INST_UUID=$INST_UUID INST_ID=$INST_ID + unalias -a INST_VDEV=$INST_VDEV" > /mnt/root/chroot echo DISK=\($(for i in ${DISK[@]}; do printf "$i "; done)\) >> /mnt/root/chroot arch-chroot /mnt bash --login - unalias -a #. Source variables:: source /root/chroot -#. Relabel filesystem on next boot:: +#. For SELinux, relabel filesystem on next boot:: fixfiles -F onboot diff --git a/docs/Getting Started/Fedora/Root on ZFS/5-bootloader.rst b/docs/Getting Started/Fedora/Root on ZFS/5-bootloader.rst index c6beb3b..49c0f2f 100644 --- a/docs/Getting Started/Fedora/Root on ZFS/5-bootloader.rst +++ b/docs/Getting Started/Fedora/Root on ZFS/5-bootloader.rst @@ -54,9 +54,6 @@ Install GRUB dracut --force --kver $kernel_version done -#. When in doubt, install both legacy boot - and EFI. - #. Disable BLS:: echo "GRUB_ENABLE_BLSCFG=false" >> /etc/default/grub @@ -70,6 +67,9 @@ Install GRUB Boot environment-specific configuration (kernel, etc) is stored in ``/boot/grub2/grub.cfg``, enabling rollback. +#. When in doubt, install both legacy boot + and EFI. + #. If using legacy booting, install GRUB to every disk:: for i in ${DISK[@]}; do @@ -93,6 +93,7 @@ Install GRUB #. For both legacy and EFI booting: mirror ESP content:: ESP_MIRROR=$(mktemp -d) + unalias -a cp -r /boot/efi/EFI $ESP_MIRROR for i in /boot/efis/*; do cp -r $ESP_MIRROR/EFI $i diff --git a/docs/Getting Started/Fedora/Root on ZFS/6-recovery.rst b/docs/Getting Started/Fedora/Root on ZFS/6-recovery.rst index b013ff8..f9ee9ce 100644 --- a/docs/Getting Started/Fedora/Root on ZFS/6-recovery.rst +++ b/docs/Getting Started/Fedora/Root on ZFS/6-recovery.rst @@ -21,13 +21,14 @@ This section is also applicable if you are in #. On another computer, generate rescue image with:: pacman -S --needed mtools libisoburn grub + grub-install grub-mkrescue -o grub-rescue.img dd if=grub-rescue.img of=/dev/your-usb-stick Boot computer from the rescue media. Both legacy and EFI mode are supported. - Skip this step if you are in GRUB rescue. + Or `download generated GRUB rescue image `__. #. List available disks with ``ls`` command:: @@ -36,20 +37,6 @@ This section is also applicable if you are in hd0 hd1 hd2 hd3 - If you are dropped to GRUB rescue instead of - booting from GRUB rescue image, boot disk can be found - out with:: - - echo $root - # cryto0 - # hd0,gpt2 - - GRUB configuration is loaded from:: - - echo $prefix - # (crypto0)/sys/BOOT/default@/grub - # (hd0,gpt2)/sys/BOOT/default@/grub - #. List partitions by pressing tab key: .. code-block:: text @@ -94,12 +81,10 @@ This section is also applicable if you are in grub> ls (crypto0)/sys/BOOT @/ default/ be0/ -#. Instruct GRUB to load configuration from ``be0`` boot environment - then enter normal mode:: +#. Instruct GRUB to load configuration from ``be0`` boot environment:: grub> prefix=(crypto0)/sys/BOOT/be0/@/grub - grub> insmod normal - grub> normal + grub> configfile $prefix/grub.cfg #. GRUB menu should now appear. @@ -188,7 +173,7 @@ Access system in chroot #. chroot into the system:: - fedora-chroot /mnt /bin/bash --login + arch-chroot /mnt /bin/bash --login zfs mount -a mount -a @@ -202,21 +187,21 @@ it is relatively easy to perform a system backup and migration. #. Create a snapshot of root file system:: - zfs snapshot -r rpool/fedora@backup - zfs snapshot -r bpool/fedora@backup + zfs snapshot -r rpool/arch@backup + zfs snapshot -r bpool/arch@backup #. Save snapshot to a file or pipe to SSH:: - zfs send --options rpool/fedora@backup > /backup/fedora-rpool - zfs send --options bpool/fedora@backup > /backup/fedora-bpool + zfs send --options rpool/arch@backup > /backup/arch-rpool + zfs send --options bpool/arch@backup > /backup/arch-bpool #. Re-create partitions and root/boot pool on target system. #. Restore backup:: - zfs recv rpool_new/fedora < /backup/fedora-rpool - zfs recv bpool_new/fedora < /backup/fedora-bpool + zfs recv rpool_new/arch < /backup/arch-rpool + zfs recv bpool_new/arch < /backup/arch-bpool #. Chroot and reinstall bootloader. diff --git a/docs/Getting Started/Fedora/index.rst b/docs/Getting Started/Fedora/index.rst index d605ec2..b2aa1d5 100644 --- a/docs/Getting Started/Fedora/index.rst +++ b/docs/Getting Started/Fedora/index.rst @@ -34,9 +34,18 @@ see below. dnf copr enable -y kwizart/kernel-longterm-5.4 dnf install -y kernel-longterm kernel-longterm-devel - # reboot to new LTS kernel + + Reboot to new LTS kernel, then load kernel module:: + modprobe zfs + It might be necessary to rebuild module:: + + ls -1 /lib/modules \ + | while read kernel_version; do + dkms autoinstall -k $kernel_version + done + #. By default ZFS kernel modules are loaded upon detecting a pool. To always load the modules at boot:: diff --git a/docs/Getting Started/RHEL-based distro/RHEL 8-based distro Root on ZFS.rst b/docs/Getting Started/RHEL-based distro/RHEL 8-based distro Root on ZFS.rst index af78590..d02d20c 100644 --- a/docs/Getting Started/RHEL-based distro/RHEL 8-based distro Root on ZFS.rst +++ b/docs/Getting Started/RHEL-based distro/RHEL 8-based distro Root on ZFS.rst @@ -1,4 +1,4 @@ -RHEL 8-based distro Root on ZFS +Rocky Linux 8 Root on ZFS ======================================= `Start here `__. diff --git a/docs/Getting Started/RHEL-based distro/RHEL 8-based distro Root on ZFS/1-preparation.rst b/docs/Getting Started/RHEL-based distro/RHEL 8-based distro Root on ZFS/1-preparation.rst index bc06cfb..da53c73 100644 --- a/docs/Getting Started/RHEL-based distro/RHEL 8-based distro Root on ZFS/1-preparation.rst +++ b/docs/Getting Started/RHEL-based distro/RHEL 8-based distro Root on ZFS/1-preparation.rst @@ -6,15 +6,15 @@ Preparation .. contents:: Table of Contents :local: -#. Download a variant of Fedora 34 live image - such as LXDE spin and boot from it. +#. Download a variant of `Rocky Linux 8.4 Live + ISO `__ and boot from it. #. Disable Secure Boot. ZFS modules can not be loaded of Secure Boot is enabled. #. Set root password or ``/root/authorized_keys``. #. Start SSH server:: echo PermitRootLogin yes >> /etc/ssh/sshd_config - systemctl start sshd + systemctl restart sshd #. Connect from another computer:: @@ -24,17 +24,17 @@ Preparation setenforce 0 -#. Install ``kernel-devel``:: - - source /etc/os-release - dnf install -y https://dl.fedoraproject.org/pub/fedora/linux/releases/${VERSION_ID}/Everything/x86_64/os/Packages/k/kernel-devel-$(uname -r).rpm - #. Add ZFS repo:: - dnf install -y https://zfsonlinux.org/fedora/zfs-release.fc${VERSION_ID}.noarch.rpm + source /etc/os-release + RHEL_ZFS_REPO=https://zfsonlinux.org/epel/zfs-release.el${VERSION_ID/./_}.noarch.rpm + dnf install -y $RHEL_ZFS_REPO #. Install ZFS packages:: + dnf config-manager --disable zfs + dnf config-manager --enable zfs-kmod + dnf install -y epel-release dnf install -y zfs #. Load kernel modules:: @@ -43,24 +43,13 @@ Preparation #. Install helper script and partition tool:: - dnf install -y arch-install-scripts gdisk + rpm -ivh --nodeps https://dl.fedoraproject.org/pub/fedora/linux/releases/34/Everything/x86_64/os/Packages/a/arch-install-scripts-23-3.fc34.noarch.rpm + dnf install -y gdisk dosfstools #. Set RHEL version:: INST_RHEL_VER=8 -#. Remove Fedora repo and install target distro repo, zfs repo:: - - rpm -qa | grep -E ^fedora | xargs -i{} rpm -e --nodeps {} - rpm -e zfs-release - ROCKY_REPO=https://dl.rockylinux.org/pub/rocky/8.4/BaseOS/x86_64/os/Packages/ - rpm -ivh \ - ${ROCKY_REPO}rocky-gpg-keys-8.4-26.el8.noarch.rpm \ - ${ROCKY_REPO}rocky-release-8.4-26.el8.noarch.rpm \ - ${ROCKY_REPO}rocky-repos-8.4-26.el8.noarch.rpm - RHEL_ZFS_REPO=https://zfsonlinux.org/epel/zfs-release.el8_4.noarch.rpm - dnf install -y ${RHEL_ZFS_REPO} epel-release - #. Unique pool suffix. ZFS expects pool names to be unique, therefore it's recommended to create pools with a unique suffix:: @@ -89,7 +78,7 @@ Preparation DISK=(/dev/disk/by-id/disk1) #. Choose a primary disk. This disk will be used - for primary EFI partition and hibernation, default to + for primary EFI partition, default to first disk in the array:: INST_PRIMARY_DISK=${DISK[0]} @@ -106,6 +95,24 @@ Preparation INST_VDEV= + This will create a single vdev with the topology of your choice. + It is also possible to manually create a pool with multiple vdevs, such as:: + + zpool create --options \ + poolName \ + mirror sda sdb \ + raidz2 sdc ... \ + raidz3 sde ... \ + spare sdf ... + + Notice the cost of parity when using RAID-Z. See + `here `__ + and `here `__. + + Refer to `zpoolconcepts `__ + and `zpool-create `__ + man pages for details. + #. Set partition size: Set ESP size:: diff --git a/docs/Getting Started/RHEL-based distro/RHEL 8-based distro Root on ZFS/2-system-installation.rst b/docs/Getting Started/RHEL-based distro/RHEL 8-based distro Root on ZFS/2-system-installation.rst index d679d9a..5da99c8 100644 --- a/docs/Getting Started/RHEL-based distro/RHEL 8-based distro Root on ZFS/2-system-installation.rst +++ b/docs/Getting Started/RHEL-based distro/RHEL 8-based distro Root on ZFS/2-system-installation.rst @@ -70,25 +70,12 @@ System Installation #. Create root pool:: zpool create \ - -d \ - -o feature@empty_bpobj=enabled \ - -o feature@lz4_compress=enabled \ - -o feature@spacemap_histogram=enabled \ - -o feature@enabled_txg=enabled \ - -o feature@hole_birth=enabled \ - -o feature@extensible_dataset=enabled \ - -o feature@embedded_data=enabled \ - -o feature@large_dnode=enabled \ - -o feature@userobj_accounting=enabled \ - -o feature@encryption=enabled \ - -o feature@project_quota=enabled \ - -o feature@spacemap_v2=enabled \ -o ashift=12 \ -o autotrim=on \ -R /mnt \ -O acltype=posixacl \ -O canmount=off \ - -O compression=lz4 \ + -O compression=zstd \ -O dnodesize=auto \ -O normalization=formD \ -O relatime=on \ @@ -232,15 +219,16 @@ System Installation #. Install base packages:: - dnf --installroot=/mnt --releasever=${INST_RHEL_VER} -y install dnf + dnf --installroot=/mnt --releasever=${INST_RHEL_VER} -y install \ + ${RHEL_ZFS_REPO} @core epel-release grub2-efi-x64 grub2-pc-modules grub2-efi-x64-modules shim-x64 efibootmgr + dnf config-manager --installroot=/mnt --disable zfs + dnf config-manager --installroot=/mnt --enable zfs-kmod + dnf install --installroot=/mnt -y zfs zfs-dracut -#. Install bootloader, kernel and ZFS:: + If speed is slow, you can manually pick a fixed mirror + from `mirrorlist `__ + and apply it:: - cp /etc/resolv.conf /mnt/etc - arch-chroot /mnt bash --login < /mnt/root/chroot echo DISK=\($(for i in ${DISK[@]}; do printf "$i "; done)\) >> /mnt/root/chroot arch-chroot /mnt bash --login - unalias -a #. Source variables:: source /root/chroot -#. Relabel filesystem on reboot:: +#. For SELinux, relabel filesystem on reboot:: fixfiles -F onboot #. Set root password:: passwd - -#. Build modules:: - - ls -1 /lib/modules \ - | while read kernel_version; do - dkms autoinstall -k $kernel_version - done diff --git a/docs/Getting Started/RHEL-based distro/RHEL 8-based distro Root on ZFS/5-bootloader.rst b/docs/Getting Started/RHEL-based distro/RHEL 8-based distro Root on ZFS/5-bootloader.rst index 9a392bb..6ac36c1 100644 --- a/docs/Getting Started/RHEL-based distro/RHEL 8-based distro Root on ZFS/5-bootloader.rst +++ b/docs/Getting Started/RHEL-based distro/RHEL 8-based distro Root on ZFS/5-bootloader.rst @@ -54,9 +54,6 @@ Install GRUB dracut --force --kver $kernel_version done -#. When in doubt, install both legacy boot - and EFI. - #. Load ZFS modules and disable BLS:: echo 'GRUB_ENABLE_BLSCFG=false' >> /etc/default/grub @@ -70,6 +67,9 @@ Install GRUB Boot environment-specific configuration (kernel, etc) is stored in ``/boot/grub2/grub.cfg``, enabling rollback. +#. When in doubt, install both legacy boot + and EFI. + #. If using legacy booting, install GRUB to every disk:: for i in ${DISK[@]}; do @@ -104,6 +104,7 @@ Install GRUB #. For both legacy and EFI booting: mirror ESP content:: ESP_MIRROR=$(mktemp -d) + unalias -a cp -r /boot/efi/EFI $ESP_MIRROR for i in /boot/efis/*; do cp -r $ESP_MIRROR/EFI $i diff --git a/docs/Getting Started/RHEL-based distro/RHEL 8-based distro Root on ZFS/6-recovery.rst b/docs/Getting Started/RHEL-based distro/RHEL 8-based distro Root on ZFS/6-recovery.rst index 89fd095..f9ee9ce 100644 --- a/docs/Getting Started/RHEL-based distro/RHEL 8-based distro Root on ZFS/6-recovery.rst +++ b/docs/Getting Started/RHEL-based distro/RHEL 8-based distro Root on ZFS/6-recovery.rst @@ -21,13 +21,14 @@ This section is also applicable if you are in #. On another computer, generate rescue image with:: pacman -S --needed mtools libisoburn grub + grub-install grub-mkrescue -o grub-rescue.img dd if=grub-rescue.img of=/dev/your-usb-stick Boot computer from the rescue media. Both legacy and EFI mode are supported. - Skip this step if you are in GRUB rescue. + Or `download generated GRUB rescue image `__. #. List available disks with ``ls`` command:: @@ -36,20 +37,6 @@ This section is also applicable if you are in hd0 hd1 hd2 hd3 - If you are dropped to GRUB rescue instead of - booting from GRUB rescue image, boot disk can be found - out with:: - - echo $root - # cryto0 - # hd0,gpt2 - - GRUB configuration is loaded from:: - - echo $prefix - # (crypto0)/sys/BOOT/default@/grub - # (hd0,gpt2)/sys/BOOT/default@/grub - #. List partitions by pressing tab key: .. code-block:: text @@ -94,12 +81,10 @@ This section is also applicable if you are in grub> ls (crypto0)/sys/BOOT @/ default/ be0/ -#. Instruct GRUB to load configuration from ``be0`` boot environment - then enter normal mode:: +#. Instruct GRUB to load configuration from ``be0`` boot environment:: grub> prefix=(crypto0)/sys/BOOT/be0/@/grub - grub> insmod normal - grub> normal + grub> configfile $prefix/grub.cfg #. GRUB menu should now appear. @@ -188,7 +173,7 @@ Access system in chroot #. chroot into the system:: - rhel-chroot /mnt /bin/bash --login + arch-chroot /mnt /bin/bash --login zfs mount -a mount -a @@ -202,21 +187,21 @@ it is relatively easy to perform a system backup and migration. #. Create a snapshot of root file system:: - zfs snapshot -r rpool/rhel@backup - zfs snapshot -r bpool/rhel@backup + zfs snapshot -r rpool/arch@backup + zfs snapshot -r bpool/arch@backup #. Save snapshot to a file or pipe to SSH:: - zfs send --options rpool/rhel@backup > /backup/rhel-rpool - zfs send --options bpool/rhel@backup > /backup/rhel-bpool + zfs send --options rpool/arch@backup > /backup/arch-rpool + zfs send --options bpool/arch@backup > /backup/arch-bpool #. Re-create partitions and root/boot pool on target system. #. Restore backup:: - zfs recv rpool_new/rhel < /backup/rhel-rpool - zfs recv bpool_new/rhel < /backup/rhel-bpool + zfs recv rpool_new/arch < /backup/arch-rpool + zfs recv bpool_new/arch < /backup/arch-bpool #. Chroot and reinstall bootloader. diff --git a/docs/Getting Started/RHEL-based distro/index.rst b/docs/Getting Started/RHEL-based distro/index.rst index 0df7b6a..a3ebae0 100644 --- a/docs/Getting Started/RHEL-based distro/index.rst +++ b/docs/Getting Started/RHEL-based distro/index.rst @@ -42,7 +42,8 @@ For RHEL/CentOS versions 6 and 7 run:: And for RHEL/CentOS 8 and newer:: - dnf install https://zfsonlinux.org/epel/zfs-release$(rpm -E %distro).noarch.rpm + source /etc/os-release + dnf install https://zfsonlinux.org/epel/zfs-release.el${VERSION_ID/./_}.noarch.rpm rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux After installing the *zfs-release* package and verifying the public key