koverstreet / bcachefs-tools

http://bcachefs.org
GNU General Public License v2.0
123 stars 90 forks source link

mount: Handle multi-device with 1 device node #245

Closed tasleson closed 6 months ago

tasleson commented 8 months ago

Instead of requiring the user to supply all the device nodes for a multi-device FS, allow them to specifiy 1 of them. We then fetch the UUID for the FS and then find all the disks on the system that match this UUID.

This allows me to bring up a bcachefs FS in /etc/fstab by using a UUID. This works because it appears the mount command looks up the UUID, finds an entry in /dev/disk/by-uuid and then passes that found device node to mount.bcachefs which fails with insufficient_devices_to_start as bcachefs is expecting a list of devices with a ":" between them. This behavior is preserved if a user specifies a list of all the needed device nodes to bring up the FS.

Notes:

tasleson commented 8 months ago

Looks like this is similar to PR https://github.com/koverstreet/bcachefs-tools/pull/142 , but different.

koverstreet commented 7 months ago

I had to think about this, and - I think this actually a pretty slick solution. This should help with systemd integration as well; we're trying to avoid systemd having to know which devices it has to wait for, and this helps with that.

JohnRTitor commented 7 months ago

And since systemd initrd still can not properly mount bcachefs on boot (systemd-udev can), I think it will fix that too.

tasleson commented 6 months ago

The first commit in this PR was merged already. The last commit in this PR has been re-worked in https://github.com/koverstreet/bcachefs-tools/pull/254