Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to mount btrfs filesystems spread across more than one partition with lklfuse #518

Open
bqv opened this issue Apr 11, 2023 · 5 comments
Assignees

Comments

@bqv
Copy link

bqv commented Apr 11, 2023

My example has three partitions. Passing partition 1 gives "BTRFS error (device vda1): devid 2 uuid is missing". Similar for partitions 2 and 3, but "devid 1".

All these devices are on one physical disk, but passing the full disk to lklfuse obviously won't work, and I'm having trouble how to wrangle the code to find that agreeable

@tavip
Copy link
Member

tavip commented Apr 11, 2023

This requires support for adding multiple disks. Then using the physical disk and multiple partitions should work. I’ll look into more details at this tomorrow.

Could you please share instructions on how to get btrfs split across multiple partitions?

@tavip tavip self-assigned this Apr 11, 2023
@bqv
Copy link
Author

bqv commented Apr 11, 2023

Assuming you have btrfsprogs, with an existing btrfs filesystem mounted at /mnt, you can add a new device as-is with btrfs device add /dev/<blk> /mnt

Thanks!

@bqv
Copy link
Author

bqv commented Jun 16, 2023

Is there a plan for implementing this?

@ddiss
Copy link

ddiss commented May 31, 2024

One option for adding devices to an existing lklfuse process at runtime is a FUSE xattr hack, e.g.:

setfattr -n lklfuse.dev.add -v /dev/sdX /mnt/

It might then also be possible to forward BTRFS_IOC_ADD_DEV ioctls through to the underlying LKL mount via a FUSE ioctl hook.

@MathewKing
Copy link

I have been experimenting with lkl and btrfs and I found that the btrfs command uses ioctl to interact with the btrfs file system. In its current state the btrfs command does not recognize a lklfuse mounted btrfs volume. I created a modified version of btrfs from here https://github.com/kdave/btrfs-progs to allow sending ioctl to the lklfuse filesystem.

From there I discovered that lklfuse does not implement ioctl. I thought that there might be a simple way to implement .ioctl in lklfuse_ops. From what I can tell there is a complication because ioctl from fuse uses 2 pointers void *arg for ioctl data from the user and void *data for ioctl data to the user but the internal call sys_ioctl uses a single pointer and the ioctl implementation will use copy_from_user() and copy_to_user().

I think that ioctl in lklfuse can be achieved by implementing raw_copy_from_user() and raw_copy_to_user() in arch/lkl. New lkl functions will need to be implemented to map the *arg and *data pointers together so when raw_copy_from_user is called, data is read from *arg and when raw_copy_to_user is called, data is written to *data.

I am not an expert on fuse or the kernel so I may be missing something. I am going to try and get ioctl working in lklfuse well enough that btrfs filesystem usage works and if I do I will post a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants