Skip to content

feat(commands): Add mount command #973

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

Merged
merged 11 commits into from
Nov 10, 2024
Merged

feat(commands): Add mount command #973

merged 11 commits into from
Nov 10, 2024

Conversation

aawsome
Copy link
Member

@aawsome aawsome commented Dec 26, 2023

This PR adds the mount command to rustic to access snapshot contents as a read-only filesystem when the feature-flag mount is chosen.

As for the webdav command, 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 mount /mnt --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.

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

Note: Requires rustic-rs/rustic_core#331 to properly show all data of files (without it builds and runs, but files are truncated and return error when reading).

Note: Building with the mount feature flag requires special dependencies and is only possible on supported platforms, see https://github.com/cberner/fuser

closes #971

@aawsome aawsome changed the title Add mount command WIP: Add mount command Dec 26, 2023
@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
@aawsome aawsome marked this pull request as ready for review June 19, 2024 06:40
@aawsome aawsome force-pushed the mount branch 2 times, most recently from e528c44 to 0b938fe Compare October 13, 2024 22:42
@aawsome
Copy link
Member Author

aawsome commented Oct 13, 2024

This PR is now ready but we may want to add the feature flag in our build-pipelines on selected targets (and include the dependencies) - in another PR.

@aawsome aawsome requested review from jjedelsky and simonsan October 13, 2024 22:59
@aawsome aawsome added the S-waiting-for-review Status: PRs waiting for review label Oct 13, 2024
@simonsan simonsan changed the title WIP: Add mount command feat: Add mount command Oct 14, 2024
@simonsan simonsan changed the title feat: Add mount command feat(commands): Add mount command Oct 20, 2024
@simonsan simonsan added C-enhancement Category: New feature or request A-commands Area: Related to commands in `rustic` labels Oct 20, 2024
@aawsome
Copy link
Member Author

aawsome commented Oct 20, 2024

rebased on top of #1329

@simonsan
Copy link
Contributor

simonsan commented Oct 20, 2024

Some things that I think we should do to prepare for this PR:

  • add build support in CI/CD
    • add to be installed dependencies to OS build matrix
    • add feature flags to OS build matrix

@simonsan simonsan removed the S-waiting-for-review Status: PRs waiting for review label Nov 10, 2024
@simonsan simonsan enabled auto-merge November 10, 2024 20:42
@simonsan simonsan added this pull request to the merge queue Nov 10, 2024
Merged via the queue into main with commit bb107be Nov 10, 2024
25 checks passed
@simonsan simonsan deleted the mount branch November 10, 2024 21:04
[mount]
path-template = "[{hostname}]/[{label}]/{time}" # The path template to use for snapshots. {id}, {id_long}, {time}, {username}, {hostname}, {label}, {tags}, {backup_start}, {backup_end} are replaced. [default: "[{hostname}]/[{label}]/{time}"]. Only relevant if no snapshot-path is given.
time-template = "%Y-%m-%d_%H-%M-%S" # only relevant if no snapshot-path is given
no-allow-other = true
Copy link
Contributor

Choose a reason for hiding this comment

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

Would name that exclusive = true or exclusive-mount = true

fh: u64,
offset: u64,
size: u32,

Copy link
Contributor

Choose a reason for hiding this comment

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

empty line

/// Don't allow other users to access the mount point
#[clap(long)]
#[merge(strategy=conflate::bool::overwrite_false)]
no_allow_other: bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above, exclusive_mount or exclusive is better I think.

/// The mount point to use
#[clap(value_name = "PATH")]
#[merge(strategy=conflate::option::overwrite_none)]
mountpoint: Option<PathBuf>,
Copy link
Contributor

Choose a reason for hiding this comment

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

mount_point

github-merge-queue bot pushed a commit that referenced this pull request Nov 25, 2024
#1353)

Addresses review feedback from #973

---------

Signed-off-by: simonsan <[email protected]>
aawsome added a commit that referenced this pull request Dec 2, 2024
## 🤖 New release
* `rustic-rs`: 0.9.4 -> 0.9.5 (✓ API compatible changes)

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

## [0.9.5](v0.9.4...v0.9.5)
- 2024-12-02

### Added

- *(commands)* More dump options
([#1339](#1339))
- shut down gracefully with ctrl+c
([#1364](#1364))
- Add --filter-jq option
([#1372](#1372))
- *(async)* use `is_async_compatible()` to determine backend
incompatibility and error out
([#1355](#1355))
- *(commands)* Add `mount` command
([#973](#973))

### Fixed

- *(commands)* run backup hooks before checking source dir
([#1374](#1374))
- *(commands)* Use spawn_blocking in webdav when calling rustic_core
([#1365](#1365))
- *(filesystem)* Use channels to communicate within webdav filesystem
([#1361](#1361))

### Other

- Add documentation for `minutely` keep option
([#1371](#1371))
- update snapshots to include minutely configuration options
- *(deps)* update rustic_core, bytes, and libc dependencies to latest
versions
- simplify lifetime annotations in OpenFileReader and TreeIterItem
implementations
- clean up whitespace and update clippy linting allowances
- *(deps)* update dependencies to latest versions
- *(deps)* update lockfile to get rid of vulnerable `url` version
- *(mount)* rename fields for clarity, add user options for mount
([#1353](#1353))
- *(deps)* update dependencies
- *(deps)* don't use rustic_core webdav feature
([#1367](#1367))
- Revert "fix(filesystem): Use channels to communicate within webdav
filesystem ([#1361](#1361))"
- Revert "feat(async): use `is_async_compatible()` to determine backend
incompatibility and error out
([#1355](#1355))"
- move `webdavfs` from `rustic_core` to `rustic-rs`
([#1363](#1363))
- *(clippy)* comment out unused lints in lib.rs
- *(clippy)* apply fixes automatically
- use BTreeMap for env in global options
([#1360](#1360))
- add tiny framework for testing rustic's compat with latest restic
([#1303](#1303))
- use snapshot tests for default config, show-config and completions
([#1359](#1359))
- *(deps)* update dependencies rustic_core, rustic_backend,
rustic_testing, and migrate to conflate 0.3
([#1357](#1357))
- fix typos
- *(build)* add platform-dependent settings and remove ci flag for extra
features
- clarify `--use-profile` command in config by using long form
([#1344](#1344))
- *(deps)* update core and testing crates
([#1340](#1340))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).

---------

Co-authored-by: rustic-release-plz[bot] <182542030+rustic-release-plz[bot]@users.noreply.github.com>
Co-authored-by: Alexander Weiss <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-commands Area: Related to commands in `rustic` C-enhancement Category: New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make mount command available on more platforms
3 participants