Update Alpine, Arch, Fedora and RHEL root on ZFS guides

Signed-off-by: Maurice Zhou <jasper@apvc.uk>
This commit is contained in:
Maurice Zhou
2023-03-07 20:24:36 +01:00
committed by George Melikov
parent a0c149af5b
commit a69befb2ce
16 changed files with 628 additions and 391 deletions

View File

@@ -10,13 +10,18 @@ System Installation
for i in ${DISK}; do
# wipe flash-based storage device to improve
# performance.
# ALL DATA WILL BE LOST
# blkdiscard -f $i
sgdisk --zap-all $i
sgdisk -n1:1M:+1G -t1:EF00 $i
sgdisk -n2:0:+4G -t2:BE00 $i
test -z $INST_PARTSIZE_SWAP || sgdisk -n4:0:+${INST_PARTSIZE_SWAP}G -t4:8200 $i
sgdisk -n4:0:+${INST_PARTSIZE_SWAP}G -t4:8200 $i
if test -z $INST_PARTSIZE_RPOOL; then
sgdisk -n3:0:0 -t3:BF00 $i
@@ -25,6 +30,12 @@ System Installation
fi
sgdisk -a1 -n5:24K:+1000K -t5:EF02 $i
sync && udevadm settle && sleep 3
cryptsetup open --type plain --key-file /dev/random $i-part4 ${i##*/}-part4
mkswap /dev/mapper/${i##*/}-part4
swapon /dev/mapper/${i##*/}-part4
done
#. Create boot pool::
@@ -84,9 +95,7 @@ System Installation
If not using a multi-disk setup, remove ``mirror``.
#. This section implements dataset layout as described in `overview <1-preparation.html>`__.
Create root system container:
#. Create root system container:
- Unencrypted::
@@ -108,18 +117,34 @@ System Installation
-o keyformat=passphrase \
rpool/archlinux
Create system datasets::
You can automate this step (insecure) with: ``echo POOLPASS | zfs create ...``.
zfs create -o canmount=on -o mountpoint=/ rpool/archlinux/root
zfs create -o canmount=on -o mountpoint=/home rpool/archlinux/home
zfs create -o canmount=off -o mountpoint=/var rpool/archlinux/var
zfs create -o canmount=on rpool/archlinux/var/lib
zfs create -o canmount=on rpool/archlinux/var/log
Create system datasets, let Archlinux declaratively
manage mountpoints with ``mountpoint=legacy``::
Create boot dataset::
zfs create -o mountpoint=legacy rpool/archlinux/root
mount -t zfs rpool/archlinux/root /mnt/
zfs create -o mountpoint=legacy rpool/archlinux/home
mkdir /mnt/home
mount -t zfs rpool/archlinux/home /mnt/home
zfs create -o mountpoint=legacy rpool/archlinux/var
zfs create -o mountpoint=legacy rpool/archlinux/var/lib
zfs create -o mountpoint=legacy rpool/archlinux/var/log
zfs create -o mountpoint=none bpool/archlinux
zfs create -o mountpoint=legacy bpool/archlinux/root
mkdir /mnt/boot
mount -t zfs bpool/archlinux/root /mnt/boot
#. zfs-mkinitcpio requires root dataset to have a mountpoint
other than legacy::
umount -Rl /mnt
zfs set canmount=noauto rpool/archlinux/root
zfs set mountpoint=/ rpool/archlinux/root
mount -t zfs -o zfsutil rpool/archlinux/root /mnt
mount -t zfs rpool/archlinux/home /mnt/home
mount -t zfs bpool/archlinux/root /mnt/boot
zfs create -o canmount=off -o mountpoint=none bpool/archlinux
zfs create -o canmount=on -o mountpoint=/boot bpool/archlinux/root
#. Format and mount ESP::
@@ -131,14 +156,3 @@ System Installation
mkdir -p /mnt/boot/efi
mount -t vfat $(echo $DISK | cut -f1 -d\ )-part1 /mnt/boot/efi
#. Install packages::
pacstrap /mnt base vi mandoc grub efibootmgr mkinitcpio
CompatibleVer=$(pacman -Si zfs-linux | grep 'Depends On' | sed "s|.*linux=||" | awk '{ print $1 }')
pacstrap -U /mnt https://archive.archlinux.org/packages/l/linux/linux-${CompatibleVer}-x86_64.pkg.tar.zst
pacstrap /mnt zfs-linux zfs-utils
pacstrap /mnt linux-firmware intel-ucode amd-ucode