incus icon indicating copy to clipboard operation
incus copied to clipboard

Add a `bcachefs` storage driver

Open stgraber opened this issue 2 years ago • 25 comments

Linux 6.7 should finally have initial support for bcachefs so we should be able to add a storage driver for it, roughly based on the btrfs or zfs one (whichever ends up closest).

@RAOF showed some initial implementation of that for LXD a while back, so that shouldn't take too much effort to get that in place and set up some testing for it.

Marking as blocked until Linux 6.7 is released.

stgraber avatar Nov 01 '23 00:11 stgraber

@RAOF did you push your LXD branch anywhere public?

stgraber avatar Nov 01 '23 00:11 stgraber

I did not. I should dust that off and put it somewhere useful!

RAOF avatar Nov 01 '23 01:11 RAOF

bcachefs is now in mainline kernel v6.7 , released 2024-01-07. It is supported by at least Archlinux and Nixos as of the v6.7 kernel release. Bcachefs is feature equivalent with Btrfs and Zfs, as far as LXD is concerned -- with the exception of a dedicated subvolume send/receive mechanism.

FlyingWombat avatar Jan 10 '24 23:01 FlyingWombat

Hey! Was also interested in approaching this issue.

Is there any additional info available/any good resources to look at for reference?

CharanSriramUni avatar Apr 01 '24 01:04 CharanSriramUni

That one is likely to be a rather large one to work on.

I've not actually done much research into bcachefs as it's such a new feature (Linux 6.7) but I'd probably start any work on this by first familiarizing myself with the filesystem and its tools, then would probably pick the existing btrfs storage driver (internal/storage/drivers/driver_btrfs*) as a rough template for the work, looking for equivalent commands and logic under bcachefs.

stgraber avatar Apr 01 '24 02:04 stgraber

Hello, my group is interested in working on this issue. Is it possible for us to be assigned to this? Thanks.

ktran1403 avatar Apr 02 '24 21:04 ktran1403

@ktran1403 given my previous comment, I suspect it would be very unlikely that your group would have sufficient time to bring this to completion. I estimate this work at a couple of weeks of full time work by someone already familiar with both bcachefs and Incus.

stgraber avatar Apr 02 '24 22:04 stgraber

@stgraber I see. Thanks for the heads-up.

ktran1403 avatar Apr 02 '24 22:04 ktran1403

Since no one else is working on this, would it be possible to break this into separate tasks/issues so we could tackle a somewhat difficult aspect of this project? We've familiarized ourselves with the codebase already given our other tasks but would love to contribute more to this project. If that's possible let us know, if not we understand!

milaiwi avatar Apr 24 '24 00:04 milaiwi

@milaiwi the first part would be getting a system with a functional bcachefs setup, so that means a 6.7 or 6.8 (probably best) Linux kernel and the bcachefs tools setup.

I'd probably then just play a bit with bcachefs, familiarize yourself with the concepts, start creating subvolumes, snapshots, setting up quotas, ... At which point you should have a good idea of what commands need to be run to deal with it, which will then have to be added to the new driver.

stgraber avatar Apr 24 '24 12:04 stgraber

Can you give an example of how we would test out the new driver and whether if Incus is detecting Bcachefs as a valid filesystem?

TinkeringWithUS avatar Apr 30 '24 22:04 TinkeringWithUS

Once you've added a minimal driver for it, restarting incus should then have the driver's load function be called and if that succeeds, it will show up in the incus info data.

stgraber avatar May 01 '24 00:05 stgraber

Yeah, we gave a stab at this but this looks like something that would need people who are more comfortable with bcachefs, as you mentioned. From what I've read bcachefs is pretty different from btrfs so we would have had to do a lot more designing.

milaiwi avatar May 03 '24 06:05 milaiwi

Yeah, it shouldn't be too too different from btrfs but it's definitely a fully new storage driver with a different way to create the storage and different commands for most of the other interactions. I also expect things like migration and quotas to work pretty differently.

stgraber avatar May 03 '24 14:05 stgraber

Hello, while this issue is no longer possible for us to finish in time for class, I still find it rather interesting. Would it be possible for me to continue working on this? So far, I've familiarized myself with bcachefs and managed to get Incus to recognize bcachefs as well as create volumes and snapshots, but there's still a lot of work to be done.

ktran1403 avatar May 06 '24 22:05 ktran1403

@ktran1403 for sure! I've assigned it to you so anyone else looking at our open issues is aware that you've started some work on this.

If you end up not having the time to work on this, just drop whatever notes you have in this issue and someone else can take it over.

stgraber avatar May 07 '24 03:05 stgraber

any updates?

thomasdba avatar Sep 02 '24 23:09 thomasdba

Unassigning due to inactivity so others can have a go at it.

stgraber avatar Oct 31 '24 15:10 stgraber