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

WIP: Add mount command #973

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

WIP: Add mount command #973

wants to merge 8 commits into from

Conversation

aawsome
Copy link
Member

@aawsome aawsome commented Dec 26, 2023

This PR adds the mount and the webdav command to rustic to access snapshot contents as a read-only filesystem.

For BOTH commands there are following options:

  • Access to a concrete snapshot/path, e.g. rustic mount /mnt 37a63e5b:/my/path.
  • Access to all snapshots (maybe restricted by filters) by using templates to define a virtual directory structure where snapshots are located. Example: rustic webdav 127.0.0.1:4999 --path-template "[{hostname}]/[{label}]/{time}" --time-template "%Y-%m-%d_%H-%M-%S" (these are also defined as default). Note that for all dirs containing only snapshots, also a latest entry is generated. latest and identical subsequent snapshots are symlinks when using mount and optionally symlinks when using webdav.

Depends on rustic-rs/rustic_core#106 and is based on #966

This PR uses fuse_mt which is not optimal as it introduces some overhead (e.g. needs to save whole Paths in-memory).

TODO:

  • use blob cache
  • handle hot/cold repositories (allow only directory listing unless explicitely specified)

@aawsome aawsome changed the title Add mount command WIP: Add mount command Dec 26, 2023
@aawsome aawsome mentioned this pull request Dec 26, 2023
src/commands/mount/fs.rs Outdated Show resolved Hide resolved
src/commands/mount.rs Outdated Show resolved Hide resolved
src/commands/mount/fs.rs Outdated Show resolved Hide resolved
let node =
repo.node_from_snapshot_path(&self.snap, |sn| config.snapshot_filter.matches(sn))?;

let options = [OsStr::new("-o"), OsStr::new("fsname=rusticfs")];
Copy link

@jjedelsky jjedelsky Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to add additional options from command line?
Eq. rustic mount -o allow_other or rustic mount -o default_permissions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Also if there are sensible defaults, we should try to use them. What are good defaults in you opinion?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imho, kernel_cache, allow_other, and default_permissions are going to be the right choice most of the time.

(For example, without allow_other, a fs mounted in toolbox (or any other container) would appear empty in gui file manager running outside of the container)

It probably might be sometimes useful to disable allow_other and default_permissions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add kernel_cache to the options.

I am wondering if we should just add an option like _no_allow_other to the mount command which then unsets both allow_other and default_permission - and without this option just set both...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds good.

@aawsome aawsome changed the title WIP: Add mount command WIP: Add mount&webdav command Jan 10, 2024
@aawsome aawsome changed the title WIP: Add mount&webdav command WIP: Add mount command Jan 28, 2024
@aawsome aawsome marked this pull request as draft January 29, 2024 00:13
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

Successfully merging this pull request may close these issues.

None yet

3 participants