Rustic is a wrapper around the Restic backup program. It adds support for backup profiles in a configuration file, to keep all your backup settings in one place.
Install with Cargo:
sh
cargo install rustic-backup
To back up the profile my_profile
, run:
sh
$ rustic backup my_profile
To forget snapshots from my_profile
using its configured retention policy, run:
sh
$ rustic forget my_profile
You can add the --prune
flag to rustic forget
to automatically delete data referenced by forgotten snapshots, or seperately run restic prune my_profile
.
To see a list of snapshots, run:
sh
$ rustic snapshots my_profile
rustic snapshots
can pass arguments through to Restic to filter which snapshots are shown:
sh
$ rustic snapshots my_profile -- --last
You can also run rustic profiles
to print out a list of all profiles and their repository locations.
In order to use Rustic, you need to configure at least one profile telling it what to back up and how. Rustic gets the path to the configuration file
from either the --config
flag or the RUSTIC_CONFIG
environment variable.
The configuration file uses TOML and has these fields:
```toml
restic
if unspecified.restic_command = "path/to/restic"
my_profile
[profiles.my_profile]
repository = "local:my-test-repository"
password_file
andcredentials_file
options, are interpreted relative to this. In most cases, it will be the root directory or yourbase_directory = "/"
rustic backup
will create the repository if it doesn't already exist. Note that rustic forget
, rustic prune
, andrustic snapshots
will not create the repository, as there isn't anything for them to do with a brand-new repository. Defaults to false.auto_init = false
password_file
orpassword_command
instead.password = "not very secret"
base_directory
.password_file = "my-password.txt"
password_command = "password-helper restic"
CACHEDIR.TAG
fileexclude_caches = false
onefilesystem = false
ignore_inode = false
environment
table described below.environment_file = "my-variables.txt"
[profiles.myprofile.environment] B2ACCOUNTID = "1234" B2ACCOUNT_KEY = "5678"
rustic forget
. All fields are optional, but rustic forget
[profiles.my_profile.retention]
keep_last = 5
keep_hourly = 24
keep_daily = 7
keep_weekly = 8
keep_monthly = 12
keep_yearly = 10
1y3m10d2h
for the past 1 year, 3 months, 10 days, and 2 hours.keep_within = "1y3m10d1h"
important
tag will be kept, andtag1
and tag2
.keep_tags = [ ["important"], ["tag1", "tag2"] ]
filesets
below[profiles.my_profile.include] patterns = [ "/etc", "/var", "/home/*/Documents" ]
[profile.my_profile.exclude] patterns = [ "*.o", "/var/log" ]
inherits = ["base_excludes"]
filesets
table. Each backup profile has a fileset specifying which files to back up and (optionally) a fileset with patterns[filesets.base_excludes] patterns = [ ".zip", ".tar", "*.tar.gz" ] ```