Talk:Bcachefs
bcachefs multidevice as rootfs
Anyone have any good suggestions for getting a multi-device filesystem to play nice with Arch's initrd? Putting /dev/sda2:/dev/sdb1 / bcachefs defaults 0 0
in fstab seems to break grub-mkconfig
's parser and init
chokes, unable to mount the filesystem. So far I've added my own hook that just does an explicit mount -t bcachefs /dev/sda2:/dev/sdb1 /new_root
which does mount it properly, but init
still chokes when it tries to parse root=
from the kernel cmdline. As a result, I'm given the recovery prompt and have to ctrl+d to continue booting.
I think with bcachefs-tools-gitAUR in the init I could do a more complex script using bcachefs show-super
to identify all of the devices in the filesystem even if only one of them is in fstab (similar to how btrfs works), but I'm not sure how to override init
's behavior with root=
.
Best idea I have so far is making a /usr/bin/mount.bcachefs-multi
(could just be a shell script depending on bcachefs-tools) which, given 1 block device from a bcachefs filesystem will attempt to find all block devices that make up that filesystem and then call mount -t bcachefs deva:devb:dev...
. This should let me put bcachefs-multi
in the fstab. But if there's a good way to override {{ic|1=root=} in the init
, then that's probably a better solution.
Bobpaul (talk) 23:21, 11 December 2019 (UTC)
- The mount.bcachefs-multi trick was a dead end. I can do
mount -t bcachefs-multi /dev/sda2 /new_root
and it successfully constructs themount -t bcachefs /dev/sda2:/dev/sdb1 /new_root
command. But the init doesn't supply the filesystem type from fstab when attempting to mount, so this doesn't get me any further than the hook I was already using. Still searching for a way to avoid getting tossed to a shell during bootup. Bobpaul (talk) 20:45, 14 December 2019 (UTC)
- The solution might be a custom initramfs. This reddit thread has some discussion to that end. However I would recommend using ext4 as root and bcachefs as /home or /var/lib. It's still easy to break, and the benefits are minor when using it for root compared to for data serving. I just made a simple mount-smb.service systemd unit for my NAS, which runs the mount command, and enabled it at startup. When it fails, which it has due to my own error, I can still easily get into the system to repair it. Vitruvius (talk) 09:15, 26 December 2019 (UTC)
- Better late than never, the current merged bcachefs code you just need bcachefs-tools installed and bcachefs in your initrd's modules.
- For several months now now it's been working well for me just defining by disk ID or part label in fstab and my bootloader.
- ie for fstab using a mix of partitions and full disk volumes
/dev/disk/by-id/nvme-KINGSTON_123_1-part3:/dev/disk/by-id/nvme-SPCC_M.2_PCIe_SSD_123_1:/dev/disk/by-id/nvme-Patriot_M.2_P310_480GB_123_1:/dev/disk/by-id/ata-ST5000DM000-123:/dev/disk/by-id/ata-ST5000DM000-456 / bcachefs rw,relatime,metadata_replicas=2,data_replicas=2,foreground_target=ssd,background_target=hdd,promote_target=ssd 0 0
- And for booting via kernel efi stub
efibootmgr --create --disk /dev/nvme0n1p1 --part 1 --label "Arch" --loader /vmlinuz-linux --unicode 'root=/dev/disk/by-id/nvme-KINGSTON_123_1-part3:/dev/disk/by-id/nvme-SPCC_M.2_PCIe_SSD_123_1:/dev/disk/by-id/nvme-Patriot_M.2_P310_480GB_123_1:/dev/disk/by-id/ata-ST5000DM000-123:/dev/disk/by-id/ata-ST5000DM000-456 rw rootfstype=bcachefs initrd=\amd-ucode.img initrd=\initramfs-linux.img'
- I had seen some talk about using X-mount.subdir= as an alternative workaround for booting using a subvolume as rootfs, maybe something in my configuration as it would end up in emergency shell looking for /sbin/init, which was there as expected as the volume mounted, however not soon enough for the boot process it seemed. Sola (talk) 01:41, 6 March 2024 (UTC)
Erasure Coding
Does it work at all? According to the blog post it's functional (despite filling hard drives with junk over time). I can turn it on on a fresh drive set, but it doesn't appear to do anything. It doesn't allow drives to fail, or take up more space, as I would expect from something like RAID 5. Vitruvius (talk)
- According to the (main) developer for bcachefs, actually writing erasure coded blocks is currently locked behind a kernel kconfig option [1]. Apparently, the feature is currently not considered stable, and according to the kernel source, may still undergo incompatible binary changes in the future. If you really want to enable it, though, you should be able to recompile the kernel with erasure coding enabled to get it working. LRFLEW (talk) 06:17, 26 January 2024 (UTC)
Bcachefs has 3 storage targets, what about metadata storage?
Actually, there's a fourth, called Metadata (--metadata_target=
) and drives with low latency read (Intel Optane) shine when used here. What is bash? (talk) 04:08, 30 December 2023 (UTC)