A restic client written in rust

@Eli6 I have already answered the lines of code question here. Currently, rustic is at about 8.500 lines of code.

About contributors, see

and

TL;DR: restic has 2-4 core developers, rustic so far only me. BTW: I’m looking forward to getting more people involved in rustic :wink:

1 Like

Interesting that you got to implement it in about 10% of the Go code. I thought Rust is lower level and should take more code than Go for the same functionality.

1 Like

In my experience the opposite is the case: Rust allows a much higher level of abstraction than Go does. This results in shorter and “cleaner” code. A good example is the error handling, which in Go is something like:

x, err :=  a.func()
if err != nil {
   return err
}

y, err := x.func2()
if err != nil {
   return err
}

while in Rust it reads:

let y = a.func()?.func2()?;
5 Likes

I’m happy to announce rustic 0.4.0

New features worth mentioning are:

  • backup option --as-path allows to overwrite the path which is saved in a snapshot
  • Snapshots are extended by label, a description and “created by program”
  • labels allow to group snapshots (and to define parent snapshots for backup) additional to hosts and paths
  • diff now allows to compare dirs in snapshots with local dirs
  • New command repair. rustic repair index is basically the equivalent to restic rebuild-index wheras rustic repair snapshots does what you can only do with restic by compiling Add repair command by aawsome · Pull Request #2876 · restic/restic · GitHub. Note that rustic binaries are available if you need that command to repair a restic repo.

For more information or questions/discussions about this rustic release, please visit rustic 0.4.0 · Discussion #306 · rustic-rs/rustic · GitHub

2 Likes

I’m happy to announce rustic 0.4.2.

Changes worth mentioning are:

  • bugs w.r.t. rclone versions are fixed as well as other bugs.
  • The command copy has been added. It only works when defining the target repo(s) in the config file in order to not getting confused by --repo2 or --target-repo options.
  • restore to a dir with already existing files is much faster as it allows to only check modification time and file size. To be sure, the option --verify-existing is available to read and verify existing file contents
  • The syntax <SNAPSHOT>:<PATH> now also works with files. For example, it is now possible to restore a single file via rustic restore a4f3:/path/to/file /path/to/destination/
  • diffing with local dirs now by default reads the files to check the contents. This allows for example to do rustic diff a4f3:/path /local/path and all files in /local/path are read and checked if they are identical to the files under /path in the given snapshot.

For more infos or questions, please visit rustic 0.4.2 · Discussion #366 · rustic-rs/rustic · GitHub

4 Likes

Nice you compile it yourself.

1 Like

Yes, compiled binaries are availabe for the releases as well as beta builds.

Also note that once you installed a rustic version, rustic self-update is available to get and install the newest release version.

Please open an issue (or submit a PR) if you are missing some platform in the compiled binaries!

Besides this, self-compilation is very easy:

  • Get the source code, e.g. by git clone
  • Install the latest stable Rust toolchain, preferably using rustup
  • Run build.sh (or cargo build --release)

Also, cross-compiling Rust is almost as easy as with Go.

2 Likes

Today, I’m announcing rustic 0.4.4. I am very proud that rustic in meanwhile got more than 300 stars in github - thanks for you all giving me motivation by this!

Changes worth mentioning are:

  • many bug fixes
  • local backend can have hooks, e.g. to generate par2 files, see How to create par2 parity files for a Restic repository - #12 by alexweiss
  • diff and restore now handle single file targets correctly, i.e. you can do rustic diff <snap>:/path/to/file localfile or rustic restore <snap>:/path/to/file /my/other/filename.
  • warm-up options are now part of the repo configuration and can also be configured in the config file
6 Likes

I just wanted to announce that rustic now experimentally supports Windows. As I don’t have a Windows system at hand Iwould like to invite everyone able to use the beta version to test it and report what’s missing.

The beta builds are available here:

If you encounter issues, best is to put them in the tracking issue:
Windows support · Issue #487 · rustic-rs/rustic · GitHub

Thanks a lot for your help!

3 Likes

I just tried the windows version. Didn’t get far

C:\Users\test> rustic init -r s:\rustic
using no config file (.\rustic.toml doesn't exist)
Error: backend s is not supported!

C:\Users\test>

@restician: This is a known issue. As workaround you can use rustic -r local:s:\rustic

Thanks!

I hoped rustic would be more compatible on the command line (options) - to avoid learning everything again (might have been also beneficial for project to get more testers “quicker”). But I also noticed that I am not able to open the rustic backup folder with “Restic-Browser”. So I guess rustic is not really a restic client (anymore)? Or I misunderstood, I guess.

It is not 100%, but very close. There are some options which have a slightly different name (like the --filter-* options where I found the restic name not a perfect choice) and of course there exists features in rustic which do not exist in restic and vice versa.

If you are referring to the -r local: option, this is only a workaround until repository paths starting with a drive letter are fixed on windows.

I am perfectly able to open and read all repositories created by rustic with Restic-Browser - under Linux. Maybe you encountered a Windows compatibility issue? Windows support of rustic is experimental and might be buggy. Please open an issue or discussion on the rustic project site with the exact error. Thanks a lot!

BTW, the latest beta builds should now be able to work with -r s:\rustic, see Windows: Allow repo to start with drive letter by aawsome · Pull Request #495 · rustic-rs/rustic · GitHub.

I’m happy to announce rustic 0.5.0.
This version adds many new features, here are some of the most interesting ones:

  • Experimental windows support has been added
  • New command merge allows to merge snapshots.
  • New option --filter-fn allows custom snapshot filter using the Rhai script language. You can use for example rustic snapshots --filter-fn '|sn| sn.host in ["host1", "host2"] && (sn.time > "2020-02-01T12:30' || sn.tags == ["only_this_tag"]). Note that this option is also available for the tag, forget, copy and merge command.
  • command dump and extended file attribute support is now also available.

For more information or questions, visit rustic 0.5.0 · rustic-rs/rustic · Discussion #529 · GitHub

rustic 0.5.1 has been released.
This release fixes a couple of minor bugs.

New features include:

  • New option --recursive for ls. Default is non-recursive if a path is given (like the usual ls command)
  • include/exclude options were added for ls and restore.

Feel free to join the discussion on the link above.

rustic 0.5.2 has been released.
Changes worth mentioning are:

  • backup has been heavily speed-optimized when reading many (small) files.
  • prune has now the option --repack-all. This is handy e.g. when you want to change the compression level of all blobs.
  • The config file treatment has been overworked. As a side effect, it is now possible to (recursively) inherit config settings from other config files.

Feel free to ask questions using rustic Discussions or to open issues!

Just wanted to mention that rustic 0.5.3 has just been release as a fix-up release as there was a nasty bug about reading config files in 0.5.2.

Other changes are:

  • support for multiple config files was added
  • the new command show-config was added to print out the config which is actually used.

rustic 0.5.4 has been released.

This is again a small bugfix release which fixes some minor bugs.

Moreover, the copy command now also allows to initialize target repositories (using the correct chunker parameters)

FYI: The next step in rustic development will be splitting it into a library and CLI part, which is already under development and will be available in the next release.

1 Like

It is definitely super interesting project and looks like includes some features still not implemented in restic.

Is there any place you document all rustic commands? I looked at github but only could find high level:

Comparison rustic vs. restic

1 Like