# rangefs [![crates.io](https://badgen.net/crates/v/rangefs)](https://crates.io/crates/rangefs) A FUSE-based read-only filesystem to map ranges in file to individual files. ## Installation Pre-built binaries are available at the GitHub release page. You can also use cargo to install it: ```sh cargo install rangefs ``` If you are using Nix, you can also install it from NUR package `nur.repos.dcsunset.rangefs`. The NUR repo also provides a NixOS module: ``` nix programs.rangefs = { enable = true; fileSystems = { "/mntpoint" = { source = "/src"; config = [ { name = "dest"; offset = 32; size = 64; } ]; extraOptions = [ "allow_other" ]; }; }; }; ``` ## Usage To mount files with range to a mount point: ```sh # mount a range as a new file rangefs --config offset=16:size=16 # multiple ranges with different names rangefs -c offset=4:name=range1 -c offset=8:size=8:name=range2 # unmount fusermount -u # To adjust log level and run at foreground RANGEFS_LOG=debug rangefs -c offset=1:size=1 --foreground ``` The mount point will be a read-only filesystem containing files that corresponding to the specified ranges in the source file. Repeat the `--config` option to mount multiple ranges. Note that the program will run in the background by default. Use flag `--foreground` to run it in the foreground. If the program exits without using `fusermount`, `fusermount` still needs to be used even after the program exits. You can also use `-a` option to auto unmount the fs upon program exit. Note that rangefs also supports block special file. However, you need to specify the length of the range. Otherwise, the default length will be 0 (same as the size in the block file metadata). Rangefs also supports mounting through `mount.fuse` or `/etc/fstab`. To specify configs, start with `config::` and separate configs by double colons. For timeout, stdout and stderr, specify `