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

Allow mounting of merged filesystems #239

Open
ruanformigoni opened this issue Sep 19, 2024 · 5 comments
Open

Allow mounting of merged filesystems #239

ruanformigoni opened this issue Sep 19, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request fixready

Comments

@ruanformigoni
Copy link

ruanformigoni commented Sep 19, 2024

Greetings!

I would like to request a feature to mount merged filesystems, i.e.:

# Assume folder-0.dwarfs has 20000 bytes
mkdwarfs folder-0 folder-0.dwarfs
mkdwarfs folder-1 folder-1.dwarfs
cp folder-0.dwarfs folder.dwarfs
cat folder-1.dwarfs >> folder.dwarfs
dwarfs folder.dwarfs mount-0
dwarfs -o offset=20000 mount-1

Currently this is not possible, when trying to mount the folder.dwarfs file I get the error:

E 15:15:05.006702 error initializing file system: dwarfs::runtime_error: truncated section data [fs_section.cpp:56]

This is for both dwarfs commands, with and without the offset.

@mhx
Copy link
Owner

mhx commented Sep 20, 2024

Something like this isn't going to work unless there's either a major change to the file system format, or you're willing to not only explicitly provide the offset, but also the length of the file system.

A DwarFS image is just a sequence of blocks; there are no explicit begin / end markers, although DwarFS assumes that the last block might be a section index. However, when simply concatenating multiple DwarFS images, there's no way to tell (other than by heuristics) where one image ends and another one starts. I'm not going to add any such heuristics, because they would very likely conflict with future extensions, such as being able to append/update DwarFS images.

So, the only option would be to explicitly provide offset/length of the image within the file.

@ruanformigoni
Copy link
Author

To provide the length of the image would be no problem for my use case, is there an option for it?

@mhx
Copy link
Owner

mhx commented Sep 20, 2024

No, there's no such option yet. It should be fairly simple to add, though.

@mhx
Copy link
Owner

mhx commented Sep 20, 2024

Please try the experimental/image-size branch. You should be able to do something like:

$ dwarfs merged.dwarfs /mnt/folder-1 -ooffset=123,imagesize=4321
$ dwarfs merged.dwarfs /mnt/folder-2 -ooffset=4711,imagesize=7999

Let me know if that works for you and I'll pull the change in for the next release.

(I've only written unit tests, but didn't actually test the FUSE driver (yet) — so definitely let me know if it's not working as expected.)

@ruanformigoni
Copy link
Author

@mhx thanks for implementing this! I just finished compiling and got the novel option in the help menu -o imagesize=NUM filesystem image size in bytes. It worked on three concatenated filesystems perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixready
Projects
None yet
Development

No branches or pull requests

2 participants