A restic client written in rust

rustic 0.3.1 has just been released.

Some new features which are worth mentioning:

  • rustic now uses the binary name rustic
  • rustic now supports client configuration in config files, see rustic/examples at main · rustic-rs/rustic · GitHub
  • rustic snapshots now summarizes identical snapshots in one line in the output
  • rustic backup now supports much more options which are known by restic

For more information or discussions about rustic’s features, please visit

2 Likes

Out of curiosity, have you compared between Restic and Rustic performance?


I do not find rustic-rs in the Arch-User-Repository (AUR), but there is other old rustic as restic wrapper.

I did some comparisons with my repositories with the result that rustic generally uses less resources (memory, CPU time) than restic. Note that, however, rustic is not yet fully parallelized, so some operations which highly benefit from parallelization perform faster on restic if you have some CPU cores at hand.

Feel free to do your own tests or a qualified comparison and report at the rustic discussions or issues.

Note that rustic compiles to a single binary with no or only standard dynamic library dependencies. You can either use a pre-compiled version (see the rustic github page) or compile it yourself by doing:

  • install rust (https://rustup.rs/)
  • download or git clone the source code
  • run cargo build -r
1 Like

rustic 0.3.2 has been released.

Some features worth mentioning:

  • the logging has been completely overworked and now supports log levels and logging to a log file
  • the restore command with log-level debug now allows to exactly see differences between a snapshot and your local files (note that a --dry-run is also present).

For more information or discussions about rustic’s features, please visit

How many lines of code are rustic and restic? And how long did they take you guys to write that code?

Restic is very popular and has many developers on GitHub, around 300. I don’t know to what extent they are involved, but the numbers are large. For rustic I imagine this is far fewer, seems to be 7 people, so you have to mostly write the code?

1 Like

@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()?;
3 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

3 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!

2 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