adam900710 / btrfs-fuse

A read-only, license friendly, FUSE based btrfs implementation
Other
26 stars 4 forks source link

btrfs-fuse

About

This is a read-only btrfs implementation using FUSE (Filesystem in Userspace).

Although btrfs is already in mainline Linux kernel, there are still use-cases for such read-only btrfs implementation:

Build

This project uses meson build system.

$ cd btrfs-fuse
$ meson setup build
$ cd build
$ ninja

This project has the following dependency:

There are some extra dependency for self-test tools:

Above dependencies are all for fsstress program.

Limitation

Currently btrfs-fuse has the following btrfs features missing:

Above features are still under active development.

When such missing features is hit, btrfs-fuse would return -EOPNOTSUPP.

While there are still some other FUSE related feature missing:

Usage

$ btrfs-fuse [<fuse options>] <device> [<extra devs> ...] <mnt>

Please note that, if multiple devices are passed into btrfs-fuse and contains different file systems, btrfs-fuse will use the last device to initialize the mount.

That's to say, for the following example:

$ mkfs.btrfs -f /dev/test/scratch1
$ mkfs.btrfs -f /dev/test/scratch2
$ btrfs-fuse /dev/test/scratch1 /dev/test/scratch2 /tmp/mount

Then only btrfs on /dev/test/scratch2 will be mounted onto /tmp/mount.

Selftest

btrfs-fuse has a self-test script in tests/test.sh.

Usage:

# ./tests/test.sh <builddir>

The test case will utilize fsstress to generate a complex enough fs with btrfs kernel module, and then use fssum to generate a summary of the whole fs. Thus it needs root privilege.

Then mount using btrfs-fuse, and compare the filesystem content against the summary.

Also for profiles with duplication, the test case will also try to remove device(s) and manually corrupt device(s) and make sure the content is still correct.

As regular dm/dm-raid can handle missing devices, but since they don't have checksum, they are not able to handle corrupted devices.

License

All files at the root directory is under MIT license.

Files under libs and tests directories are under their own licenses. Mostly GPL-2.0+ or GPL-2.0-only.

Those external libs include:

For projects which want to have btrfs read-only support, and already has a FUSE-like interface (like GRUB), those files should not be cross-ported to the project as above licenses are not compatible with the target project.

Instead either use wrappers around the interfaces provided by the target project, or start from scratch and follow the license of the target project.