User:Pietinger/temp/test
Hi @xarvatium,
Update 2024-02-25: I will wait until kernel version 6.9 because of this: https://www.phoronix.com/news/Bcachefs-Disk-Account-Rewrite
Update 2024-05-19: I will wait until kernel version 6.10 because of this: https://www.phoronix.com/news/Linux-6.10-Bcachefs
Update 2024-08-18: I will wait until kernel version 6.11 because of this: https://www.phoronix.com/news/Bcachefs-Merge-Linux-6.11-rc4
Links
- User:Xarvatium/Bcachefs_rootfs
- encrypted bcachefs root partition [[1]]
Old
I am highly interested in a bcachefs-solution for the root partition with two SSDs as RAID-1 (and with encryption).
[- Deleted old stuff -]
A working solution was presented in our Gentoo forum (link above).
- Jumping in as I'm interested in this too
- This looks like it should work, I'll chuck it in a VM as I want to the hook at https://github.com/breavyn/dracut-bcachefs/tree/master for encryption and there is maybe a chance we can hack that to let booting work until grub gets bcachefs support.
- Immolo (talk) 01:56, 13 January 2024 (UTC)
Hi @immolo, great you are in !
Preliminary test: What happens if a hard disk of a (encrypted) bcache RAID1 fails ?
I have formatted two unused partitions with bcachefs:
# bcachefs format /dev/sda1 /dev/sda2 --replicas=2 --encrypt --wide_macs --acl --verbose Enter passphrase: Enter same passphrase again: # mkdir /mnt/bc
After this I had this problem:
# mount.bcachefs /dev/sda1:/dev/sda2 /mnt/bc ERROR - bcachefs_rust::cmd_mount: Fatal error: Required key not available
I found this: https://lore.kernel.org/all/12360099.O9o76ZdvQC@lichtvoll.de/T/ and did it:
# keyctl link @u @s # mount.bcachefs /dev/sda1:/dev/sda2 /mnt/bc
Now it worked. I copied a file into it and made a subvolume:
/mnt/bc # bcachefs subvolume create /mnt/bc/etc /mnt/bc # lal insgesamt 8 drwxr-xr-x 3 root root 0 19. Jan 20:59 . drwxr-xr-x 6 root root 4096 19. Jan 20:42 .. -rw-r--r-- 1 root root 342 19. Jan 20:58 BCACHEFS.txt drwxr-xr-x 2 root root 0 19. Jan 20:59 etc drwx------ 2 root root 0 19. Jan 20:56 lost+found
THEN I destoyed /dev/sda1
# cd # umount /mnt/bc/ # mkfs.ext4 /dev/sda1
NOW: Can I mount /dev/sda2 ... and HOW ?
# mount.bcachefs /dev/sda1:/dev/sda2 /mnt/bc bcachefs (/dev/sda1): error reading default superblock: Not a bcachefs superblock bcachefs (/dev/sda1): error reading superblock: Not a bcachefs superblock layout ERROR - bcachefs_rust::cmd_mount: Fatal error: "invalid_sb_layout"
NOPE
# mount.bcachefs -o degraded /dev/sda1:/dev/sda2 /mnt/bc bcachefs (/dev/sda1): error reading default superblock: Not a bcachefs superblock bcachefs (/dev/sda1): error reading superblock: Not a bcachefs superblock layout ERROR - bcachefs_rust::cmd_mount: Fatal error: "invalid_sb_layout"
NOPE
# mount.bcachefs /dev/sda2 /mnt/bc ERROR - bcachefs_rust::cmd_mount: Fatal error: Invalid argument
NOPE
# mount.bcachefs -o degraded /dev/sda2 /mnt/bc # cd /mnt/bc /mnt/bc # lal insgesamt 8 drwxr-xr-x 3 root root 0 19. Jan 20:59 . drwxr-xr-x 6 root root 4096 19. Jan 20:42 .. -rw-r--r-- 1 root root 342 19. Jan 20:58 BCACHEFS.txt drwxr-xr-x 2 root root 0 19. Jan 20:59 etc drwx------ 2 root root 0 19. Jan 20:56 lost+found
Aaahh ... :-) ... AND ... there is no second question for my password ... SO ... How do I programm it in my init-file of my initramfs ? Before I will try it on my test partitions:
# nano test.sh => #!/bin/sh ### CHANGE THIS ! myrootpartition="/dev/sda1:/dev/sda2" abend() { echo "$@" echo "You are now in a rescue shell." busybox --install -s exec /bin/sh } third_try() { echo "There was again a problem. Trying last chance !" /sbin/mount.bcachefs -o degraded /dev/sda2 /mnt/bc exit } second_try() { echo "There was a problem. Trying something different !" /sbin/mount.bcachefs -o degraded /dev/sda1 /mnt/bc || third_try exit } #echo "Mounting proc, sys, and devtmpfs ..." #mount -t devtmpfs none /dev || abend "Error: mount /devtmpfs failed !" #mount -t proc none /proc || abend "Error: mount /proc failed !" #mount -t sysfs none /sys || abend "Error: mount /sysfs failed !" echo "Mounting root partition ..." /sbin/mount.bcachefs $myrootpartition /mnt/bc || second_try #echo "Unmounting proc, sys, and devtmpfs ..." #umount /proc /sys /dev <=
You see, this is NOT a busybox-script ... you have to change something ;-) Giving it a +x and run it
# ./test.sh Mounting root partition ... bcachefs (/dev/sda1): error reading default superblock: Not a bcachefs superblock bcachefs (/dev/sda1): error reading superblock: Not a bcachefs superblock layout ERROR - bcachefs_rust::cmd_mount: Fatal error: "invalid_sb_layout" There was a problem. Trying something different ! bcachefs (/dev/sda1): error reading default superblock: Not a bcachefs superblock bcachefs (/dev/sda1): error reading superblock: Not a bcachefs superblock layout ERROR - bcachefs_rust::cmd_mount: Fatal error: "invalid_sb_layout" There was again a problem. Trying last chance ! ~ # ~ # cd /mnt/bc/ /mnt/bc # ll insgesamt 4 -rw-r--r-- 1 root root 342 19. Jan 20:58 BCACHEFS.txt drwxr-xr-x 2 root root 0 19. Jan 20:59 etc drwx------ 2 root root 0 19. Jan 20:56 lost+found
Okay ... now the last problem: This does not look very nice (Maybe some programmers are dying now ...). For now it was only an alpha test ...