Przejdź do treści

Gentoo bcachefs root and dracut

  • przez

I had some trouble getting the system to run with bcachefs as root, but eventually it worked:

Prepare pendrive to boot from:

Install gentoo on usb with following changes:

Get the kernel 6.7.* or never and set required options:

File Systems --->
   <*> bcachefs filesystem support
[*]   bcachefs POSIX ACL support 

emerge --ask sys-fs/bcachefs-tools

Run computer from that usb. 

prepare the disks on target machine:
I have 2 nvme disks and one big hdd:
make partitions on /dev/nvme0n1 (p1 for UEFI) p2
make partition on /dev/nvme1n1
make partition on /dev/sda

bcachefs format --compression=lz4 --label=ssd.ssd1 /dev/nvme0n1p2 --label=ssd.ssd2 /dev/nvme1n1 --label=hdd.hdd1 /dev/sda --foreground_target=ssd --promote_target=ssd --background_target=hdd > /mnt/bcache.log

(I redirected the outpu to later usage -> notice first External UUID)
mount:
bcachefs mount UUID=<paste external UUID here> /mnt/gentoo

Install gento as usual on /mnt/gentoo

emerge --ask sys-kernel/dracut

Add dracut custom module:


cd /usr/lib/dracut/modules.d
mkdir 04bcachefs
cd 04bcachefs

cp /sbin/bcachefs .
nano module-setup.sh

#!/bin/bash
check() {
return 0
}

depends() {
return 0
}

install() {
inst_hook cmdline 10 "$moddir/bcachefs.sh"
}

nano bcachefs.sh

#!/bin/sh
root=$(getarg root=)
echo "root=$root"
bcachefs mount $root /sysroot
umount /dev /proc /sys
exec switch_root /sysroot /sbin/init

nano /etc/dracut.conf
add_dracutmodules+=" bcachefs "

dracut -f
try:
grub-mkconfig -o /boot/grub/grub.cfg 

/usr/sbin/grub-probe: error: failed to get canonical path of `/dev/nvme0n1p2:/dev/nvme1n1p1:/dev/sda1'.
this will propably fail, because bcachefs didn't appear in /dev/disk/by-uuid so You have to create grub.cfg by hand or copy from usb and tweak a bit eg. 
edit the line 
linux	/vmlinuz-6.7.4-gentoo rootfstype=bcachefs rootwait rootdelay=5 root=UUID=<paste External UUID here> ro

Write it down and pray it works :)

So there are things that have to be done before Linux will normally boot from bcachefs root:

mount command to natively support bcachefs
kernel /dev/disk/by-uuid issue
grub-probe





Dodaj komentarz

Twój adres e-mail nie zostanie opublikowany. Wymagane pola są oznaczone *