Published on
August 18, 2025
ZFS-Root & ZFSBootMenu
1 minute read •
Vorraussetzung: Mit einer ZFS fähigen Bootdisk (z.B. SystemRescue-ZFS) gestartet.
Festplatte vorbereiten:
mkdir -- parents /mnt/gentoo
sgdisk - Z /dev/sda
sgdisk - a 4096 -- new= 1:+0:+1G -- typecode= 1:EF00 -- change-name= 1:" EFI" /dev/sda
sgdisk - a 4096 -- new= 2:+129M:+4G -- typecode= 2:8200 -- change-name= 2:" Linux swap" /dev/sda
sgdisk - a 4096 -- new= 3:+129M:-129M -- typecode= 3:bf00 -- change-name= 3:" tank" /dev/sda
ZFS Pool anlegen
zpool create - f \
- o ashift=12 - o autotrim=on \
- O acltype=posixacl - O xattr=sa - O atime=off - O compression=lz4 \
- m none tank /dev/sda3
zfs create - o mountpoint=none tank/OS
zfs create - o mountpoint=/ - o canmount=noauto tank/OS/gentoo
zfs create - o mountpoint=/home - o relatime=on tank/HOME
zfs create - o mountpoint=none - o setuid=off tank/GENTOO
zfs create - o mountpoint=/var/db/repos - o exec=off tank/GENTOO/repos
zfs create - o mountpoint=/var/db/repos/gentoo tank/GENTOO/portage
zfs create - o mountpoint=/var/cache/distfiles - o compression=off - o exec=off tank/GENTOO/distfiles
zfs create - o mountpoint=/var/tmp/portage - o sync=disabled tank/GENTOO/build-dir
zfs create - o mountpoint=none - o setuid=off tank/VAR
zfs create - o mountpoint=/var/log - o sync=disabled tank/VAR/log
zfs create - o mountpoint=/tmp - o sync=disabled tank/VAR/tmp
zfs create - o mountpoint=none - o setuid=off tank/SRV
zfs create - o mountpoint=/var/www tank/SRV/www
...
zpool set bootfs=tank/OS/gentoo tank
zpool export tank
ZFS Pool laden
zpool import - N - R /mnt/gentoo tank
zfs mount tank/OS/gentoo
zfs mount - R tank/HOME
zfs mount - R tank/GENTOO
zfs mount - R tank/VAR
zfs mount - R tank/SRV
mkswap /dev/sda2
swapon /dev/sda2
mkfs.vfat - F 32 /dev/sda1
mkdir -- parents /mnt/gentoo/efi
Gentoo installieren
chmod 1777 /mnt/gentoo/tmp
wget ' ftp://gentoo.osuosl.org/pub/gentoo/releases/amd64/autobuilds/current-stage3-amd64-openrc/stage3-amd64-openrc-[0-9]*.tar.xz'
tar xpvf stage3-* .tar.xz -- xattrs-include= ' *.*' -- numeric-owner - C /mnt/gentoo
cp -- dereference /etc/resolv.conf /mnt/gentoo/etc/
echo ' MAKEOPTS="-j4 -l5"' >> /mnt/gentoo/etc/portage/make.conf
echo ' RUSTFLAGS="${RUSTFLAGS} -C target-cpu=native"' >> /mnt/gentoo/etc/portage/make.conf
… weiter mit der Standard Gentoo Installation
emerge - av sys-kernel/gentoo-kernel
Kernel konfigurieren und compilieren
make localmodconfig
make nconfig
emerge - av sys-fs/zfs
Alphaquadrant-Overlay installieren
cat << EOF > /etc/portage/repos.conf/migmedia.conf
[AlphaQuadrant]
priority = 20
location = /var/db/repos/alpha-quadrant
sync-type = git
sync-uri = https://git.migmedia.net/gentoo/alpha-quadrant.git
auto-sync = true
masters = gentoo
EOF
emaint sync - a
emerge - av sys-boot/zfsbootmenu sys-boot/efibootmgr
zfs set org.zfsbootmenu:commandline=" quiet loglevel=4" tank/OS
Datei /etc/zfsbootmenu/config.yaml
ändern:
Global :
ManageImages : true
BootMountPoint : /boot/efi
[ . ..]
EFI :
Enabled : true
Kernel :
CommandLine : ro quiet loglevel=0 zbm.show
generate-zbm
efibootmgr - c - d /dev/sda - p 1 - L " ZFSBootMenu" - l \\ EFI\\ ZBM\\ VMLINUZ.EFI
System laden zum Reparieren
mkdir /mnt/gentoo
zpool import - N - R /mnt/gentoo tank - f
zfs mount tank/OS/gentoo
zfs mount - R tank/HOME
zfs mount - R tank/VAR
zfs mount - R tank/GENTOO
mount /dev/sda1 /mnt/gentoo/boot/efi
Referenzen: