Fixes for Fedora; support Rocky Linux Live ISO
Signed-off-by: Maurice Zhou <jasper@apvc.uk>
This commit is contained in:
committed by
George Melikov
parent
9261cfb4f5
commit
ae7c5d19f4
@@ -104,6 +104,24 @@ Preparation
|
|||||||
|
|
||||||
INST_VDEV=
|
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 <https://www.delphix.com/blog/delphix-engineering/zfs-raidz-stripe-width-or-how-i-learned-stop-worrying-and-love-raidz>`__
|
||||||
|
and `here <https://docs.google.com/spreadsheets/d/1tf4qx1aMJp8Lo_R6gpT689wTjHv6CGVElrPqTA0w_ZY/>`__.
|
||||||
|
|
||||||
|
Refer to `zpoolconcepts <https://openzfs.github.io/openzfs-docs/man/7/zpoolconcepts.7.html>`__
|
||||||
|
and `zpool-create <https://openzfs.github.io/openzfs-docs/man/8/zpool-create.8.html>`__
|
||||||
|
man pages for details.
|
||||||
|
|
||||||
#. Set partition size:
|
#. Set partition size:
|
||||||
|
|
||||||
Set ESP size. ESP contains Live ISO for recovery,
|
Set ESP size. ESP contains Live ISO for recovery,
|
||||||
|
|||||||
@@ -92,6 +92,10 @@ System Configuration
|
|||||||
|
|
||||||
arch-chroot /mnt passwd
|
arch-chroot /mnt passwd
|
||||||
|
|
||||||
|
#. Generate host id::
|
||||||
|
|
||||||
|
zgenhostid -f -o /mnt/etc/hostid
|
||||||
|
|
||||||
#. Ignore kernel updates::
|
#. Ignore kernel updates::
|
||||||
|
|
||||||
sed -i 's/#IgnorePkg/IgnorePkg/' /mnt/etc/pacman.conf
|
sed -i 's/#IgnorePkg/IgnorePkg/' /mnt/etc/pacman.conf
|
||||||
|
|||||||
@@ -50,9 +50,6 @@ Install GRUB
|
|||||||
|
|
||||||
mkinitcpio -P
|
mkinitcpio -P
|
||||||
|
|
||||||
#. When in doubt, install both legacy boot
|
|
||||||
and EFI.
|
|
||||||
|
|
||||||
#. Create GRUB boot directory, in ESP and boot pool::
|
#. Create GRUB boot directory, in ESP and boot pool::
|
||||||
|
|
||||||
mkdir -p /boot/efi/EFI/arch
|
mkdir -p /boot/efi/EFI/arch
|
||||||
@@ -61,6 +58,9 @@ Install GRUB
|
|||||||
Boot environment-specific configuration (kernel, etc)
|
Boot environment-specific configuration (kernel, etc)
|
||||||
is stored in ``/boot/grub/grub.cfg``, enabling rollback.
|
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::
|
#. If using legacy booting, install GRUB to every disk::
|
||||||
|
|
||||||
for i in ${DISK[@]}; do
|
for i in ${DISK[@]}; do
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ Preparation
|
|||||||
|
|
||||||
#. Install helper script and partition tool::
|
#. Install helper script and partition tool::
|
||||||
|
|
||||||
dnf install -y arch-install-scripts gdisk
|
dnf install -y arch-install-scripts gdisk dosfstools
|
||||||
|
|
||||||
#. Target Fedora version::
|
#. Target Fedora version::
|
||||||
|
|
||||||
@@ -94,6 +94,24 @@ Preparation
|
|||||||
|
|
||||||
INST_VDEV=
|
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 <https://www.delphix.com/blog/delphix-engineering/zfs-raidz-stripe-width-or-how-i-learned-stop-worrying-and-love-raidz>`__
|
||||||
|
and `here <https://docs.google.com/spreadsheets/d/1tf4qx1aMJp8Lo_R6gpT689wTjHv6CGVElrPqTA0w_ZY/>`__.
|
||||||
|
|
||||||
|
Refer to `zpoolconcepts <https://openzfs.github.io/openzfs-docs/man/7/zpoolconcepts.7.html>`__
|
||||||
|
and `zpool-create <https://openzfs.github.io/openzfs-docs/man/8/zpool-create.8.html>`__
|
||||||
|
man pages for details.
|
||||||
|
|
||||||
#. Set partition size:
|
#. Set partition size:
|
||||||
|
|
||||||
Set ESP size::
|
Set ESP size::
|
||||||
|
|||||||
@@ -81,6 +81,10 @@ System Configuration
|
|||||||
|
|
||||||
``systemd-firstboot`` have bugs, root password is set below.
|
``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::
|
#. Install locale package, example for English locale::
|
||||||
|
|
||||||
dnf --installroot=/mnt install -y glibc-minimal-langpack glibc-langpack-en
|
dnf --installroot=/mnt install -y glibc-minimal-langpack glibc-langpack-en
|
||||||
@@ -95,6 +99,7 @@ System Configuration
|
|||||||
disable SSH server::
|
disable SSH server::
|
||||||
|
|
||||||
systemctl disable sshd --root=/mnt
|
systemctl disable sshd --root=/mnt
|
||||||
|
systemctl enable firewalld --root=/mnt
|
||||||
|
|
||||||
#. Chroot::
|
#. Chroot::
|
||||||
|
|
||||||
@@ -102,16 +107,16 @@ System Configuration
|
|||||||
INST_LINVAR=$INST_LINVAR
|
INST_LINVAR=$INST_LINVAR
|
||||||
INST_UUID=$INST_UUID
|
INST_UUID=$INST_UUID
|
||||||
INST_ID=$INST_ID
|
INST_ID=$INST_ID
|
||||||
|
unalias -a
|
||||||
INST_VDEV=$INST_VDEV" > /mnt/root/chroot
|
INST_VDEV=$INST_VDEV" > /mnt/root/chroot
|
||||||
echo DISK=\($(for i in ${DISK[@]}; do printf "$i "; done)\) >> /mnt/root/chroot
|
echo DISK=\($(for i in ${DISK[@]}; do printf "$i "; done)\) >> /mnt/root/chroot
|
||||||
arch-chroot /mnt bash --login
|
arch-chroot /mnt bash --login
|
||||||
unalias -a
|
|
||||||
|
|
||||||
#. Source variables::
|
#. Source variables::
|
||||||
|
|
||||||
source /root/chroot
|
source /root/chroot
|
||||||
|
|
||||||
#. Relabel filesystem on next boot::
|
#. For SELinux, relabel filesystem on next boot::
|
||||||
|
|
||||||
fixfiles -F onboot
|
fixfiles -F onboot
|
||||||
|
|
||||||
|
|||||||
@@ -54,9 +54,6 @@ Install GRUB
|
|||||||
dracut --force --kver $kernel_version
|
dracut --force --kver $kernel_version
|
||||||
done
|
done
|
||||||
|
|
||||||
#. When in doubt, install both legacy boot
|
|
||||||
and EFI.
|
|
||||||
|
|
||||||
#. Disable BLS::
|
#. Disable BLS::
|
||||||
|
|
||||||
echo "GRUB_ENABLE_BLSCFG=false" >> /etc/default/grub
|
echo "GRUB_ENABLE_BLSCFG=false" >> /etc/default/grub
|
||||||
@@ -70,6 +67,9 @@ Install GRUB
|
|||||||
Boot environment-specific configuration (kernel, etc)
|
Boot environment-specific configuration (kernel, etc)
|
||||||
is stored in ``/boot/grub2/grub.cfg``, enabling rollback.
|
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::
|
#. If using legacy booting, install GRUB to every disk::
|
||||||
|
|
||||||
for i in ${DISK[@]}; do
|
for i in ${DISK[@]}; do
|
||||||
@@ -93,6 +93,7 @@ Install GRUB
|
|||||||
#. For both legacy and EFI booting: mirror ESP content::
|
#. For both legacy and EFI booting: mirror ESP content::
|
||||||
|
|
||||||
ESP_MIRROR=$(mktemp -d)
|
ESP_MIRROR=$(mktemp -d)
|
||||||
|
unalias -a
|
||||||
cp -r /boot/efi/EFI $ESP_MIRROR
|
cp -r /boot/efi/EFI $ESP_MIRROR
|
||||||
for i in /boot/efis/*; do
|
for i in /boot/efis/*; do
|
||||||
cp -r $ESP_MIRROR/EFI $i
|
cp -r $ESP_MIRROR/EFI $i
|
||||||
|
|||||||
@@ -21,13 +21,14 @@ This section is also applicable if you are in
|
|||||||
#. On another computer, generate rescue image with::
|
#. On another computer, generate rescue image with::
|
||||||
|
|
||||||
pacman -S --needed mtools libisoburn grub
|
pacman -S --needed mtools libisoburn grub
|
||||||
|
grub-install
|
||||||
grub-mkrescue -o grub-rescue.img
|
grub-mkrescue -o grub-rescue.img
|
||||||
dd if=grub-rescue.img of=/dev/your-usb-stick
|
dd if=grub-rescue.img of=/dev/your-usb-stick
|
||||||
|
|
||||||
Boot computer from the rescue media.
|
Boot computer from the rescue media.
|
||||||
Both legacy and EFI mode are supported.
|
Both legacy and EFI mode are supported.
|
||||||
|
|
||||||
Skip this step if you are in GRUB rescue.
|
Or `download generated GRUB rescue image <https://gitlab.com/m_zhou/bieaz/uploads/4a1b7cefb42723de6eb04f9dc485be3b/grub-rescue.img.7z>`__.
|
||||||
|
|
||||||
#. List available disks with ``ls`` command::
|
#. List available disks with ``ls`` command::
|
||||||
|
|
||||||
@@ -36,20 +37,6 @@ This section is also applicable if you are in
|
|||||||
|
|
||||||
hd0 hd1 hd2 hd3
|
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:
|
#. List partitions by pressing tab key:
|
||||||
|
|
||||||
.. code-block:: text
|
.. code-block:: text
|
||||||
@@ -94,12 +81,10 @@ This section is also applicable if you are in
|
|||||||
grub> ls (crypto0)/sys/BOOT
|
grub> ls (crypto0)/sys/BOOT
|
||||||
@/ default/ be0/
|
@/ default/ be0/
|
||||||
|
|
||||||
#. Instruct GRUB to load configuration from ``be0`` boot environment
|
#. Instruct GRUB to load configuration from ``be0`` boot environment::
|
||||||
then enter normal mode::
|
|
||||||
|
|
||||||
grub> prefix=(crypto0)/sys/BOOT/be0/@/grub
|
grub> prefix=(crypto0)/sys/BOOT/be0/@/grub
|
||||||
grub> insmod normal
|
grub> configfile $prefix/grub.cfg
|
||||||
grub> normal
|
|
||||||
|
|
||||||
#. GRUB menu should now appear.
|
#. GRUB menu should now appear.
|
||||||
|
|
||||||
@@ -188,7 +173,7 @@ Access system in chroot
|
|||||||
|
|
||||||
#. chroot into the system::
|
#. chroot into the system::
|
||||||
|
|
||||||
fedora-chroot /mnt /bin/bash --login
|
arch-chroot /mnt /bin/bash --login
|
||||||
zfs mount -a
|
zfs mount -a
|
||||||
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::
|
#. Create a snapshot of root file system::
|
||||||
|
|
||||||
zfs snapshot -r rpool/fedora@backup
|
zfs snapshot -r rpool/arch@backup
|
||||||
zfs snapshot -r bpool/fedora@backup
|
zfs snapshot -r bpool/arch@backup
|
||||||
|
|
||||||
#. Save snapshot to a file or pipe to SSH::
|
#. Save snapshot to a file or pipe to SSH::
|
||||||
|
|
||||||
zfs send --options rpool/fedora@backup > /backup/fedora-rpool
|
zfs send --options rpool/arch@backup > /backup/arch-rpool
|
||||||
zfs send --options bpool/fedora@backup > /backup/fedora-bpool
|
zfs send --options bpool/arch@backup > /backup/arch-bpool
|
||||||
|
|
||||||
#. Re-create partitions and root/boot
|
#. Re-create partitions and root/boot
|
||||||
pool on target system.
|
pool on target system.
|
||||||
|
|
||||||
#. Restore backup::
|
#. Restore backup::
|
||||||
|
|
||||||
zfs recv rpool_new/fedora < /backup/fedora-rpool
|
zfs recv rpool_new/arch < /backup/arch-rpool
|
||||||
zfs recv bpool_new/fedora < /backup/fedora-bpool
|
zfs recv bpool_new/arch < /backup/arch-bpool
|
||||||
|
|
||||||
#. Chroot and reinstall bootloader.
|
#. Chroot and reinstall bootloader.
|
||||||
|
|
||||||
|
|||||||
@@ -34,9 +34,18 @@ see below.
|
|||||||
|
|
||||||
dnf copr enable -y kwizart/kernel-longterm-5.4
|
dnf copr enable -y kwizart/kernel-longterm-5.4
|
||||||
dnf install -y kernel-longterm kernel-longterm-devel
|
dnf install -y kernel-longterm kernel-longterm-devel
|
||||||
# reboot to new LTS kernel
|
|
||||||
|
Reboot to new LTS kernel, then load kernel module::
|
||||||
|
|
||||||
modprobe zfs
|
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.
|
#. By default ZFS kernel modules are loaded upon detecting a pool.
|
||||||
To always load the modules at boot::
|
To always load the modules at boot::
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
RHEL 8-based distro Root on ZFS
|
Rocky Linux 8 Root on ZFS
|
||||||
=======================================
|
=======================================
|
||||||
`Start here <RHEL%208-based%20distro%20Root%20on%20ZFS/0-overview.html>`__.
|
`Start here <RHEL%208-based%20distro%20Root%20on%20ZFS/0-overview.html>`__.
|
||||||
|
|
||||||
|
|||||||
@@ -6,15 +6,15 @@ Preparation
|
|||||||
.. contents:: Table of Contents
|
.. contents:: Table of Contents
|
||||||
:local:
|
:local:
|
||||||
|
|
||||||
#. Download a variant of Fedora 34 live image
|
#. Download a variant of `Rocky Linux 8.4 Live
|
||||||
such as LXDE spin and boot from it.
|
ISO <https://dl.rockylinux.org/pub/rocky/8.4/Live/x86_64/>`__ and boot from it.
|
||||||
|
|
||||||
#. Disable Secure Boot. ZFS modules can not be loaded of Secure Boot is enabled.
|
#. Disable Secure Boot. ZFS modules can not be loaded of Secure Boot is enabled.
|
||||||
#. Set root password or ``/root/authorized_keys``.
|
#. Set root password or ``/root/authorized_keys``.
|
||||||
#. Start SSH server::
|
#. Start SSH server::
|
||||||
|
|
||||||
echo PermitRootLogin yes >> /etc/ssh/sshd_config
|
echo PermitRootLogin yes >> /etc/ssh/sshd_config
|
||||||
systemctl start sshd
|
systemctl restart sshd
|
||||||
|
|
||||||
#. Connect from another computer::
|
#. Connect from another computer::
|
||||||
|
|
||||||
@@ -24,17 +24,17 @@ Preparation
|
|||||||
|
|
||||||
setenforce 0
|
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::
|
#. 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::
|
#. Install ZFS packages::
|
||||||
|
|
||||||
|
dnf config-manager --disable zfs
|
||||||
|
dnf config-manager --enable zfs-kmod
|
||||||
|
dnf install -y epel-release
|
||||||
dnf install -y zfs
|
dnf install -y zfs
|
||||||
|
|
||||||
#. Load kernel modules::
|
#. Load kernel modules::
|
||||||
@@ -43,24 +43,13 @@ Preparation
|
|||||||
|
|
||||||
#. Install helper script and partition tool::
|
#. 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::
|
#. Set RHEL version::
|
||||||
|
|
||||||
INST_RHEL_VER=8
|
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 pool suffix. ZFS expects pool names to be
|
||||||
unique, therefore it's recommended to create
|
unique, therefore it's recommended to create
|
||||||
pools with a unique suffix::
|
pools with a unique suffix::
|
||||||
@@ -89,7 +78,7 @@ Preparation
|
|||||||
DISK=(/dev/disk/by-id/disk1)
|
DISK=(/dev/disk/by-id/disk1)
|
||||||
|
|
||||||
#. Choose a primary disk. This disk will be used
|
#. 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::
|
first disk in the array::
|
||||||
|
|
||||||
INST_PRIMARY_DISK=${DISK[0]}
|
INST_PRIMARY_DISK=${DISK[0]}
|
||||||
@@ -106,6 +95,24 @@ Preparation
|
|||||||
|
|
||||||
INST_VDEV=
|
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 <https://www.delphix.com/blog/delphix-engineering/zfs-raidz-stripe-width-or-how-i-learned-stop-worrying-and-love-raidz>`__
|
||||||
|
and `here <https://docs.google.com/spreadsheets/d/1tf4qx1aMJp8Lo_R6gpT689wTjHv6CGVElrPqTA0w_ZY/>`__.
|
||||||
|
|
||||||
|
Refer to `zpoolconcepts <https://openzfs.github.io/openzfs-docs/man/7/zpoolconcepts.7.html>`__
|
||||||
|
and `zpool-create <https://openzfs.github.io/openzfs-docs/man/8/zpool-create.8.html>`__
|
||||||
|
man pages for details.
|
||||||
|
|
||||||
#. Set partition size:
|
#. Set partition size:
|
||||||
|
|
||||||
Set ESP size::
|
Set ESP size::
|
||||||
|
|||||||
@@ -70,25 +70,12 @@ System Installation
|
|||||||
#. Create root pool::
|
#. Create root pool::
|
||||||
|
|
||||||
zpool create \
|
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 ashift=12 \
|
||||||
-o autotrim=on \
|
-o autotrim=on \
|
||||||
-R /mnt \
|
-R /mnt \
|
||||||
-O acltype=posixacl \
|
-O acltype=posixacl \
|
||||||
-O canmount=off \
|
-O canmount=off \
|
||||||
-O compression=lz4 \
|
-O compression=zstd \
|
||||||
-O dnodesize=auto \
|
-O dnodesize=auto \
|
||||||
-O normalization=formD \
|
-O normalization=formD \
|
||||||
-O relatime=on \
|
-O relatime=on \
|
||||||
@@ -232,15 +219,16 @@ System Installation
|
|||||||
|
|
||||||
#. Install base packages::
|
#. 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 <https://mirrors.rockylinux.org/mirrormanager/mirrors>`__
|
||||||
|
and apply it::
|
||||||
|
|
||||||
cp /etc/resolv.conf /mnt/etc
|
sed -i 's|^mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/*
|
||||||
arch-chroot /mnt bash --login <<EOF
|
sed -i 's|^#baseurl=|baseurl=|g' /etc/yum.repos.d/*
|
||||||
dnf --releasever=${INST_RHEL_VER} -y install ${RHEL_ZFS_REPO} \
|
sed -i 's|dl.rockylinux.org/$contentdir|mirrors.sjtug.sjtu.edu.cn/rocky|g' /etc/yum.repos.d/*
|
||||||
@core epel-release \
|
|
||||||
grub2-efi-x64 grub2-pc-modules grub2-efi-x64-modules shim-x64 efibootmgr \
|
|
||||||
kernel kernel-devel
|
|
||||||
dnf --releasever=${INST_RHEL_VER} -y install zfs zfs-dracut
|
|
||||||
EOF
|
|
||||||
|
|||||||
@@ -46,18 +46,22 @@ System Configuration
|
|||||||
#. Interactively set locale, keymap, timezone, hostname and root password::
|
#. Interactively set locale, keymap, timezone, hostname and root password::
|
||||||
|
|
||||||
rm -f /mnt/etc/localtime
|
rm -f /mnt/etc/localtime
|
||||||
systemd-firstboot --root=/mnt --force --prompt --root-password=PASSWORD
|
systemd-firstboot --root=/mnt --prompt --root-password=PASSWORD
|
||||||
|
|
||||||
This can be non-interactive, see man page for details::
|
This can be non-interactive, see man page for details::
|
||||||
|
|
||||||
rm -f /mnt/etc/localtime
|
rm -f /mnt/etc/localtime
|
||||||
systemd-firstboot --root=/mnt --force \
|
systemd-firstboot --root=/mnt \
|
||||||
--locale="en_US.UTF-8" --locale-messages="en_US.UTF-8" \
|
--locale="en_US.UTF-8" --locale-messages="en_US.UTF-8" \
|
||||||
--keymap=us --timezone="Europe/Berlin" --hostname=myHost \
|
--keymap=us --timezone="Europe/Berlin" --hostname=myHost \
|
||||||
--root-password=PASSWORD --root-shell=/bin/bash
|
--root-password=PASSWORD
|
||||||
|
|
||||||
``systemd-firstboot`` have bugs, root password is set below.
|
``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::
|
#. Install locale package, example for English locale::
|
||||||
|
|
||||||
dnf --installroot=/mnt install -y glibc-minimal-langpack glibc-langpack-en
|
dnf --installroot=/mnt install -y glibc-minimal-langpack glibc-langpack-en
|
||||||
@@ -72,6 +76,7 @@ System Configuration
|
|||||||
disable SSH server::
|
disable SSH server::
|
||||||
|
|
||||||
systemctl disable sshd --root=/mnt
|
systemctl disable sshd --root=/mnt
|
||||||
|
systemctl enable firewalld --root=/mnt
|
||||||
|
|
||||||
#. Chroot::
|
#. Chroot::
|
||||||
|
|
||||||
@@ -79,27 +84,20 @@ System Configuration
|
|||||||
INST_LINVAR=$INST_LINVAR
|
INST_LINVAR=$INST_LINVAR
|
||||||
INST_UUID=$INST_UUID
|
INST_UUID=$INST_UUID
|
||||||
INST_ID=$INST_ID
|
INST_ID=$INST_ID
|
||||||
|
unalias -a
|
||||||
INST_VDEV=$INST_VDEV
|
INST_VDEV=$INST_VDEV
|
||||||
TERM=xterm" > /mnt/root/chroot
|
TERM=xterm" > /mnt/root/chroot
|
||||||
echo DISK=\($(for i in ${DISK[@]}; do printf "$i "; done)\) >> /mnt/root/chroot
|
echo DISK=\($(for i in ${DISK[@]}; do printf "$i "; done)\) >> /mnt/root/chroot
|
||||||
arch-chroot /mnt bash --login
|
arch-chroot /mnt bash --login
|
||||||
unalias -a
|
|
||||||
|
|
||||||
#. Source variables::
|
#. Source variables::
|
||||||
|
|
||||||
source /root/chroot
|
source /root/chroot
|
||||||
|
|
||||||
#. Relabel filesystem on reboot::
|
#. For SELinux, relabel filesystem on reboot::
|
||||||
|
|
||||||
fixfiles -F onboot
|
fixfiles -F onboot
|
||||||
|
|
||||||
#. Set root password::
|
#. Set root password::
|
||||||
|
|
||||||
passwd
|
passwd
|
||||||
|
|
||||||
#. Build modules::
|
|
||||||
|
|
||||||
ls -1 /lib/modules \
|
|
||||||
| while read kernel_version; do
|
|
||||||
dkms autoinstall -k $kernel_version
|
|
||||||
done
|
|
||||||
|
|||||||
@@ -54,9 +54,6 @@ Install GRUB
|
|||||||
dracut --force --kver $kernel_version
|
dracut --force --kver $kernel_version
|
||||||
done
|
done
|
||||||
|
|
||||||
#. When in doubt, install both legacy boot
|
|
||||||
and EFI.
|
|
||||||
|
|
||||||
#. Load ZFS modules and disable BLS::
|
#. Load ZFS modules and disable BLS::
|
||||||
|
|
||||||
echo 'GRUB_ENABLE_BLSCFG=false' >> /etc/default/grub
|
echo 'GRUB_ENABLE_BLSCFG=false' >> /etc/default/grub
|
||||||
@@ -70,6 +67,9 @@ Install GRUB
|
|||||||
Boot environment-specific configuration (kernel, etc)
|
Boot environment-specific configuration (kernel, etc)
|
||||||
is stored in ``/boot/grub2/grub.cfg``, enabling rollback.
|
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::
|
#. If using legacy booting, install GRUB to every disk::
|
||||||
|
|
||||||
for i in ${DISK[@]}; do
|
for i in ${DISK[@]}; do
|
||||||
@@ -104,6 +104,7 @@ Install GRUB
|
|||||||
#. For both legacy and EFI booting: mirror ESP content::
|
#. For both legacy and EFI booting: mirror ESP content::
|
||||||
|
|
||||||
ESP_MIRROR=$(mktemp -d)
|
ESP_MIRROR=$(mktemp -d)
|
||||||
|
unalias -a
|
||||||
cp -r /boot/efi/EFI $ESP_MIRROR
|
cp -r /boot/efi/EFI $ESP_MIRROR
|
||||||
for i in /boot/efis/*; do
|
for i in /boot/efis/*; do
|
||||||
cp -r $ESP_MIRROR/EFI $i
|
cp -r $ESP_MIRROR/EFI $i
|
||||||
|
|||||||
@@ -21,13 +21,14 @@ This section is also applicable if you are in
|
|||||||
#. On another computer, generate rescue image with::
|
#. On another computer, generate rescue image with::
|
||||||
|
|
||||||
pacman -S --needed mtools libisoburn grub
|
pacman -S --needed mtools libisoburn grub
|
||||||
|
grub-install
|
||||||
grub-mkrescue -o grub-rescue.img
|
grub-mkrescue -o grub-rescue.img
|
||||||
dd if=grub-rescue.img of=/dev/your-usb-stick
|
dd if=grub-rescue.img of=/dev/your-usb-stick
|
||||||
|
|
||||||
Boot computer from the rescue media.
|
Boot computer from the rescue media.
|
||||||
Both legacy and EFI mode are supported.
|
Both legacy and EFI mode are supported.
|
||||||
|
|
||||||
Skip this step if you are in GRUB rescue.
|
Or `download generated GRUB rescue image <https://gitlab.com/m_zhou/bieaz/uploads/4a1b7cefb42723de6eb04f9dc485be3b/grub-rescue.img.7z>`__.
|
||||||
|
|
||||||
#. List available disks with ``ls`` command::
|
#. List available disks with ``ls`` command::
|
||||||
|
|
||||||
@@ -36,20 +37,6 @@ This section is also applicable if you are in
|
|||||||
|
|
||||||
hd0 hd1 hd2 hd3
|
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:
|
#. List partitions by pressing tab key:
|
||||||
|
|
||||||
.. code-block:: text
|
.. code-block:: text
|
||||||
@@ -94,12 +81,10 @@ This section is also applicable if you are in
|
|||||||
grub> ls (crypto0)/sys/BOOT
|
grub> ls (crypto0)/sys/BOOT
|
||||||
@/ default/ be0/
|
@/ default/ be0/
|
||||||
|
|
||||||
#. Instruct GRUB to load configuration from ``be0`` boot environment
|
#. Instruct GRUB to load configuration from ``be0`` boot environment::
|
||||||
then enter normal mode::
|
|
||||||
|
|
||||||
grub> prefix=(crypto0)/sys/BOOT/be0/@/grub
|
grub> prefix=(crypto0)/sys/BOOT/be0/@/grub
|
||||||
grub> insmod normal
|
grub> configfile $prefix/grub.cfg
|
||||||
grub> normal
|
|
||||||
|
|
||||||
#. GRUB menu should now appear.
|
#. GRUB menu should now appear.
|
||||||
|
|
||||||
@@ -188,7 +173,7 @@ Access system in chroot
|
|||||||
|
|
||||||
#. chroot into the system::
|
#. chroot into the system::
|
||||||
|
|
||||||
rhel-chroot /mnt /bin/bash --login
|
arch-chroot /mnt /bin/bash --login
|
||||||
zfs mount -a
|
zfs mount -a
|
||||||
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::
|
#. Create a snapshot of root file system::
|
||||||
|
|
||||||
zfs snapshot -r rpool/rhel@backup
|
zfs snapshot -r rpool/arch@backup
|
||||||
zfs snapshot -r bpool/rhel@backup
|
zfs snapshot -r bpool/arch@backup
|
||||||
|
|
||||||
#. Save snapshot to a file or pipe to SSH::
|
#. Save snapshot to a file or pipe to SSH::
|
||||||
|
|
||||||
zfs send --options rpool/rhel@backup > /backup/rhel-rpool
|
zfs send --options rpool/arch@backup > /backup/arch-rpool
|
||||||
zfs send --options bpool/rhel@backup > /backup/rhel-bpool
|
zfs send --options bpool/arch@backup > /backup/arch-bpool
|
||||||
|
|
||||||
#. Re-create partitions and root/boot
|
#. Re-create partitions and root/boot
|
||||||
pool on target system.
|
pool on target system.
|
||||||
|
|
||||||
#. Restore backup::
|
#. Restore backup::
|
||||||
|
|
||||||
zfs recv rpool_new/rhel < /backup/rhel-rpool
|
zfs recv rpool_new/arch < /backup/arch-rpool
|
||||||
zfs recv bpool_new/rhel < /backup/rhel-bpool
|
zfs recv bpool_new/arch < /backup/arch-bpool
|
||||||
|
|
||||||
#. Chroot and reinstall bootloader.
|
#. Chroot and reinstall bootloader.
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ For RHEL/CentOS versions 6 and 7 run::
|
|||||||
|
|
||||||
And for RHEL/CentOS 8 and newer::
|
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
|
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux
|
||||||
|
|
||||||
After installing the *zfs-release* package and verifying the public key
|
After installing the *zfs-release* package and verifying the public key
|
||||||
|
|||||||
Reference in New Issue
Block a user