### REST Server URL Examples Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/rest.md Examples demonstrating different REST server URL configurations, including authentication and custom paths. ```toml repository = "rest:http://host:8000/" repository = "rest:http://user:pass@host:8000/" repository = "rest:http://user:pass@host:8000/my_backup_repo" ``` -------------------------------- ### Start WebDAV Server Source: https://github.com/rustic-rs/docs/blob/main/src/commands/restore/webdav.md Run this command to start a WebDAV server for your repository. You can then connect using a standard WebDAV client. ```console $ rustic webdav ``` -------------------------------- ### Install mdbook-pandoc plugin Source: https://github.com/rustic-rs/docs/blob/main/Readme.md Installs the mdbook-pandoc plugin for rendering the book to PDF. ```sh cargo install mdbook-pandoc ``` -------------------------------- ### Install mdbook Source: https://github.com/rustic-rs/docs/blob/main/Readme.md Installs the mdbook toolchain for building documentation. ```sh cargo install mdbook ``` -------------------------------- ### Install Rustic using cargo-binstall Source: https://github.com/rustic-rs/docs/blob/main/src/installation.md Use cargo-binstall to install the Rustic binary. Ensure cargo-binstall is installed first. ```bash cargo binstall rustic-rs ``` -------------------------------- ### Example Warmup Command for AWS S3 Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/cold_storage.md This example shows a direct warmup configuration for AWS S3, using the 'restore-object' command. It specifies the bucket, key, and restoration tier. Ensure the bucket name and other parameters are correctly set for your environment. ```shell warm-up-command = 'aws s3api restore-object --bucket COLD-BUCKET --key %pack --restore-request \'{"Days":25,"GlacierJobParameters":{"Tier":"Standard"}}\'' warm-up-time = '4h' ``` -------------------------------- ### Example Repository Configuration Profile Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/configuration_file.md A TOML configuration file defining repository settings. ```toml [repository] repository = "/backup/rustic" password-file = "/root/key-rustic" no-cache = true # no cache needed for local repository ``` -------------------------------- ### Install TeX Live and Dependencies Source: https://github.com/rustic-rs/docs/blob/main/Readme.md Installs TeX Live, essential LaTeX packages, fonts, and librsvg for PDF rendering. It also sources environment variables and downloads a specific Pandoc version. ```sh # Source the .env file to get the PANDOC_VERSION . ./.env sudo apt-get update sudo apt-get install -y texlive texlive-latex-extra texlive-luatex texlive-lang-cjk librsvg2-bin fonts-noto curl -LsSf https://github.com/jgm/pandoc/releases/download/$PANDOC_VERSION/pandoc-$PANDOC_VERSION-linux-amd64.tar.gz | tar zxf - ``` -------------------------------- ### Install Rustic from Github Source Source: https://github.com/rustic-rs/docs/blob/main/src/installation.md Install the latest development version of Rustic directly from its Github repository using Cargo. ```bash cargo install --git https://github.com/rustic-rs/rustic.git rustic-rs ``` -------------------------------- ### Rustic Configuration File Example Source: https://github.com/rustic-rs/docs/blob/main/src/getting_started.md This snippet shows the content of a typical rustic configuration file, specifying the repository location and password. ```console $ cat ~/.config/rustic/rustic.toml [repository] repository = "/tmp/repo" password = "test" ``` -------------------------------- ### Install Fish Completions Source: https://github.com/rustic-rs/docs/blob/main/src/commands/misc/completions.md Redirect the output of 'rustic completions fish' to the Fish completions directory to enable Fish shell completions. ```sh rustic completions fish > $HOME/.config/fish/completions/rustic.fish ``` -------------------------------- ### Install Rustic using Scoop on Windows Source: https://github.com/rustic-rs/docs/blob/main/src/installation.md Use the Scoop package manager to install Rustic on Windows systems. ```bash scoop install rustic ``` -------------------------------- ### Example Profile Inheritance with 'use-profiles' Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/configuration_file.md A TOML configuration file demonstrating profile inheritance using the 'use-profiles' directive. ```toml [global] use-profiles = ["repo", "retention"] ``` -------------------------------- ### Install Bash Completions Source: https://github.com/rustic-rs/docs/blob/main/src/commands/misc/completions.md Redirect the output of 'rustic completions bash' to the specified directory to enable Bash completions. ```sh rustic completions bash > /etc/bash_completion.d/rustic.bash ``` -------------------------------- ### List Files with rclone Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/rclone.md Example of using rclone directly to list files in a remote bucket. This is useful for verifying rclone configuration before using it with rustic. ```console rclone ls b2prod:yggdrasil ``` -------------------------------- ### Install Rustic from crates.io Source: https://github.com/rustic-rs/docs/blob/main/src/installation.md Install the latest stable version of Rustic from the crates.io registry using Cargo. The --locked flag ensures reproducible builds. ```bash cargo install --locked rustic-rs ``` -------------------------------- ### Install mdbook-last-changed plugin Source: https://github.com/rustic-rs/docs/blob/main/Readme.md Installs the mdbook-last-changed plugin for displaying last modified dates. ```sh cargo install mdbook-last-changed ``` -------------------------------- ### Install PowerShell Completions on Windows Source: https://github.com/rustic-rs/docs/blob/main/src/commands/misc/completions.md Append the output of 'rustic completions powershell' to the PowerShell profile script for Windows. ```sh rustic completions powershell >> $HOME\Documents\PowerShell\Microsoft.PowerShell_profile.ps1. ``` -------------------------------- ### Basic TOML Configuration for Hooks Source: https://github.com/rustic-rs/docs/blob/main/src/commands/misc/hooks.md Example TOML structure showing all possible hook types at global, repository, and backup levels. Each hook is a list of commands to be executed. ```toml [global.hooks] run-before = [] run-after = [] run-failed = [] run-finally = [] [repository.hooks] run-before = [] run-after = [] run-failed = [] run-finally = [] [backup.hooks] run-before = [] run-after = [] run-failed = [] run-finally = [] [[backup.snapshots]] sources = [] [backup.snapshots.hooks] run-before = [] run-after = [] run-failed = [] run-finally = [] ``` -------------------------------- ### Install Zsh Completions Source: https://github.com/rustic-rs/docs/blob/main/src/commands/misc/completions.md Redirect the output of 'rustic completions zsh' to a Zsh site-functions directory to enable Zsh completions. ```sh rustic completions zsh > /usr/local/share/zsh/site-functions/_rustic ``` -------------------------------- ### Install PowerShell Completions on Linux Source: https://github.com/rustic-rs/docs/blob/main/src/commands/misc/completions.md Append the output of 'rustic completions powershell' to the PowerShell profile script for Linux. ```sh rustic completions powershell >> ~/.config/powershell/Microsoft.PowerShell_profile.ps1. ``` -------------------------------- ### Example Retention Configuration Profile Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/configuration_file.md A TOML configuration file defining forget/retention settings. ```toml [forget] keep-daily = 14 keep-weekly = 5 ``` -------------------------------- ### Install PowerShell Completions on macOS Source: https://github.com/rustic-rs/docs/blob/main/src/commands/misc/completions.md Append the output of 'rustic completions powershell' to the PowerShell profile script for macOS. ```sh rustic completions powershell >> ~/.config/powershell/Microsoft.PowerShell_profile.ps1 ``` -------------------------------- ### List Files in an Empty Rustic Repository via rclone Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/rclone.md Demonstrates the output of 'rclone ls' when listing files in a path that is managed by rustic and configured via rclone. Shows example file listings. ```console $ rclone ls b2prod:yggdrasil/foo/bar/baz 155 bar/baz/config 448 bar/baz/keys/4bf9c78049de689d73a56ed0546f83b8416795295cda12ec7fb9465af3900b44 ``` -------------------------------- ### Backup Notification Hook Source: https://github.com/rustic-rs/docs/blob/main/src/commands/misc/hooks.md Example of a `run-after` hook for the backup command to send a notification upon successful completion. ```toml [backup.hooks] run-after = ["notify-send 'Backup finished successfully!'"] ``` -------------------------------- ### Example Rustic TOML Configuration Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/configuration_file.md A TOML configuration file demonstrating settings for repository, forget, backup exclusions, glob files, and snapshot definitions. ```toml # rustic config file to backup /home and /etc to a local repository [repository] repository = "/backup/rustic" password-file = "/root/key-rustic" no-cache = true # no cache needed for local repository [forget] keep-daily = 14 keep-weekly = 5 [backup] exclude-if-present = [".nobackup", "CACHEDIR.TAG"] glob-files = ["/root/rustic-local.glob"] [[backup.snapshots]] name = "home" sources = ["/home"] git-ignore = true [[backup.snapshots]] name = "etc" sources = ["/etc"] ``` -------------------------------- ### Configure Amazon S3 Repository Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/services.md Example TOML configuration for setting up an Amazon S3 repository. This includes basic repository settings and service-specific options for S3 access. ```toml [repository] repository = "opendal:s3" password = "password" # Other options can be given here - note that opendal also support reading config from env # files or AWS config dirs, see the opendal S3 docs for more information # https://opendal.apache.org/docs/rust/opendal/services/struct.S3.html [repository.options] access_key_id = "xxx" # this can be ommited, when AWS config is used secret_access_key = "xxx" # this can be ommited, when AWS config is used bucket = "bucket_name" root = "/path/to/repo" ``` -------------------------------- ### CLI Command for Filtering Snapshots to Copy Source: https://github.com/rustic-rs/docs/blob/main/src/commands/misc/filter.md Use CLI options to filter snapshots when performing a copy operation. This example filters by host and tags. ```console rustic copy --filter-host luigi --filter-tags foo,bar ``` -------------------------------- ### Replace Tags with --forget and --set-tags Source: https://github.com/rustic-rs/docs/blob/main/src/commands/misc/rewrite.md This example demonstrates replacing all existing tags with a single new tag using `--forget` and `--set-tags`. It's a way to reset the tag list for a snapshot. ```console # Replace the tag list $ rustic rewrite --forget --set-tags origin 3f1560c5 $ rustic snapshots --all --filter-paths Project snapshots for (host [kasimir], label [], paths [Project]) | ID | Host | Label | Tags | Paths | Files | Dirs | Size | |----------|---------|-------|--------|---------|-------|------|-----------| | 7a690c53 | kasimir | | origin | Project | 507 | 87 | 524.0 KiB | | 7f3eef1f | kasimir | | | Project | 507 | 87 | 524.0 KiB | 2 snapshot(s) total: 2 snapshot(s) ``` -------------------------------- ### Subsequent Backup Snapshot with Deduplication Source: https://github.com/rustic-rs/docs/blob/main/src/commands/backup/creating_snapshots.md Creates another snapshot of the same directory. This example demonstrates the speed increase and reduced data addition due to deduplication, as previous data is reused. ```console $ rustic --log-level debug backup ~/work open repository enter password for repository: password is correct lock repository load index files using parent snapshot d875ae93 start scan start backup scan finished in 1.881s processed 1.720 GiB in 0:03 Files: 0 new, 0 changed, 5307 unmodified Dirs: 0 new, 0 changed, 1867 unmodified Added: 0 B snapshot 79766175 saved ``` -------------------------------- ### Using Glob Patterns and Glob Files for Exclusion Source: https://github.com/rustic-rs/docs/blob/main/src/commands/backup/excluding_files.md Combine `--glob` for direct pattern exclusion with `--glob-file` to specify patterns from a file. This example excludes `.c` files and uses `glob.txt` to exclude `.go` files and specific directory structures. ```text # exclude go-files !*.go # exclude foo/x/y/z/bar foo/x/bar foo/bar !foo/**/bar ``` ```console rustic backup ~/work --glob="!*.c" --glob-file=glob.txt ``` -------------------------------- ### Rustic Repository Configuration with Hot Storage (TOML) Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/cold_storage.md Configure Rustic to use both a cold and a hot repository using TOML format. The 'repository' option points to the cold storage, while 'repo-hot' specifies the location for hot data. This setup is used during the 'rustic init' command. ```toml [repository] repository = "rclone:foo:cold-repo" repo-hot = "rclone:foo:hot-repo" ``` -------------------------------- ### Example: Keep Last 4 Daily Snapshots Source: https://github.com/rustic-rs/docs/blob/main/src/commands/forget/remove_by_policy.md Demonstrates how 'rustic forget --keep-daily 4' retains the four most recent daily snapshots and removes the rest. Shows the dry-run output indicating which snapshots are kept and which are removed. ```console $ rustic forget --keep-daily 4 --dry-run repository f00c6e2a opened successfully, password is correct Applying Policy: keep the last 4 daily snapshots keep 4 snapshots: ID Time Host Tags Reasons Paths 8f8018c0 2019-10-27 11:00:00 mopped daily snapshot /home/user/work 59403279 2019-11-03 11:00:00 mopped daily snapshot /home/user/work dfee9fb4 2019-11-10 11:00:00 mopped daily snapshot /home/user/work e1ae2f40 2019-11-17 11:00:00 mopped daily snapshot /home/user/work 4 snapshots remove 8 snapshots: ID Time Host Tags Paths 0a1f9759 2019-09-01 11:00:00 mopped /home/user/work 46cfe4d5 2019-09-08 11:00:00 mopped /home/user/work f6b1f037 2019-09-15 11:00:00 mopped /home/user/work eb430a5d 2019-09-22 11:00:00 mopped /home/user/work 8cf1cb9a 2019-09-29 11:00:00 mopped /home/user/work 5d33b116 2019-10-06 11:00:00 mopped /home/user/work b9553125 2019-10-13 11:00:00 mopped /home/user/work e1a7b58b 2019-10-20 11:00:00 mopped /home/user/work 8 snapshots ``` -------------------------------- ### Initialize a New Rustic Repository Source: https://github.com/rustic-rs/docs/blob/main/src/commands/misc/intro.md Use the `init` command to create a new Rustic repository. You will be prompted to enter and confirm a password for the repository. Remember that losing this password means irrecoverable data loss. ```console $ rustic init enter password for new repository: enter password again: created rustic repository 7a8c3b2a0c at /srv/rustic-repo Please note that knowledge of your password is required to access the repository. Losing your password means that your data is irrecoverably lost. ``` -------------------------------- ### Initialize Rustic Repository Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/intro.md Create a new Rustic repository using the default configuration profile. Rustic will prompt for credentials if not otherwise specified. ```console rustic init ``` -------------------------------- ### Create Mount Point and Mount Repository Source: https://github.com/rustic-rs/docs/blob/main/src/commands/restore/using_mount.md Create a directory to serve as the mount point and then use the `rustic mount` command to make the repository accessible as a filesystem. ```bash mkdir /mnt/rustic rustic mount /mnt/rustic ``` -------------------------------- ### Initialize Repository with Compression Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/intro.md Set the zstd compression level for the repository during initialization. Higher levels offer better compression but may increase CPU usage. ```console rustic init --set-compression ``` -------------------------------- ### Initialize Local Rustic Repository Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/local.md Use this command to create a new local repository. You will be prompted to enter and confirm a password for the repository. ```console $ rustic init -r /srv/rustic-repo enter password for new repository: created rustic repository 085b3c76b9 at /srv/rustic-repo ``` -------------------------------- ### Serve Documentation with mdbook Source: https://github.com/rustic-rs/docs/blob/main/Readme.md Serves the documentation locally at http://localhost:3000 and enables live reloading on changes. ```sh mdbook serve ``` -------------------------------- ### Verify Tarball with Rsign2 Source: https://github.com/rustic-rs/docs/blob/main/src/nightly_builds.md Use this command to verify the integrity of a downloaded tarball using rsign2. Ensure you have rsign2 installed. ```console rsign verify .tar.gz \ -x .tar.gz.sig \ -P RWSWSCEJEEacVeCy0va71hlrVtiW8YzMzOyJeso0Bfy/ZXq5OryWi/8T ``` -------------------------------- ### List, Add, and Remove Repository Keys Source: https://github.com/rustic-rs/docs/blob/main/src/commands/misc/key.md Demonstrates the usage of 'rustic key list', 'rustic key add', and 'rustic key remove' to manage repository access keys. Shows how to add a new key with specific user and host, list existing keys, and remove a key by its ID. ```console $ rustic key list enter password for repository: | ID | User | Host | Created | |-----------|----------|---------|--------------------------------------| | *8a9d4286 | username | kasimir | 2025-08-12 13:29:57.759858440 +02:00 | $ rustic key add --with-created --username alex --hostname batman enter password for new key: [hidden] [INFO] key 70970299 successfully added. $ rustic key list enter password for repository: | ID | User | Host | Created | |-----------|----------|---------|--------------------------------------| | *8a9d4286 | username | kasimir | 2025-08-12 13:29:57.759858440 +02:00 | | 70970299 | alex | batman | 2025-10-11 22:37:29.759858440 +02:00 | $ rustic key remove 7 [INFO] key 70970299 successfully removed. ``` -------------------------------- ### Initialize Repository with Specific Version Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/intro.md Initialize a new repository and explicitly set its version using the `--set-version` option. This is useful for compatibility or to leverage specific features. ```console rustic init --set-version ``` -------------------------------- ### Cross-compile Rustic using Cargo Source: https://github.com/rustic-rs/docs/blob/main/src/installation.md Build Rustic for a specific target architecture using Cargo. Ensure the necessary cross-compilation toolchain is installed. ```console cargo build --target aarch64-unknown-linux-gnu --release ``` -------------------------------- ### List Initial Snapshots Source: https://github.com/rustic-rs/docs/blob/main/src/commands/misc/rewrite.md Displays all snapshots for a given path, showing their IDs, hosts, labels, tags, paths, file counts, directory counts, and sizes. This is useful for understanding the state before performing rewrite operations. ```console # Initial state: $ rustic snapshots --all --filter-paths Project snapshots for (host [kasimir], label [], paths [Project]) | ID | Host | Label | Tags | Paths | Files | Dirs | Size | |----------|---------|-------|------|---------|-------|------|-----------| | 7f3eef1f | kasimir | | | Project | 507 | 87 | 524.0 KiB | | 5109f5fe | kasimir | | | Project | 508 | 87 | 524.0 KiB | | ca466029 | kasimir | | | Project | 509 | 87 | 524.0 KiB | 3 snapshot(s) total: 3 snapshot(s) ``` -------------------------------- ### Build Documentation with mdbook Source: https://github.com/rustic-rs/docs/blob/main/Readme.md Builds static HTML pages for the documentation and places them in the /book directory. ```sh mdbook build ``` -------------------------------- ### Initialize Repository with Custom Chunker Settings Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/intro.md Configure the chunker algorithm and size parameters when initializing a repository. This allows fine-tuning how data is split. ```console rustic init --set-chunker --set-chunk-size --set-chunk-min-size --set-chunk-max-size ``` -------------------------------- ### Initialize Target Repository with Matching Chunker Parameters Source: https://github.com/rustic-rs/docs/blob/main/src/commands/misc/deduplication.md Use the `--init` option with the `rustic copy` command to initialize a non-existing target repository with the same chunker parameters as the source repository. This ensures deduplication can function correctly. The target repository must be defined in the config file. ```console rustic copy --init [SNAPSHOTS] ``` -------------------------------- ### Perform Initial Backup Source: https://github.com/rustic-rs/docs/blob/main/src/getting_started.md Command to perform the first backup of a directory. This includes creating the directory and a test file. ```console $ mkdir src $ echo "test me" > src/test.txt $ rustic backup src [INFO] using config /home/jamesvasile/.config/rustic/rustic.toml [INFO] repository local:/tmp/repo: password is correct. [INFO] using cache at /home/jamesvasile/.cache/rustic/3f64ae7425245b259ff98d1dcb6f49035af391f271da7b9ff643fd3f26408601 [00:00:00] reading index... ████████████████████████████████████████ 0/0 [00:00:00] getting latest snapshot... ████████████████████████████████████████ 0/0 [INFO] using no parent [INFO] starting to backup "src"... [00:00:00] backing up... ████████████████████████████████████████ 8 B/8 B 432 B/s (ETA 0s) Files: 1 new, 0 changed, 0 unchanged Dirs: 2 new, 0 changed, 0 unchanged Added to the repo: 476 B (raw: 529 B) processed 1 files, 8 B snapshot 8171d606 successfully saved. [INFO] backup of "src" done. ``` -------------------------------- ### Set rclone Bandwidth Limit via Environment Variable Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/rclone.md Configures the bandwidth limit for rclone operations by setting the RCLONE_BWLIMIT environment variable. This example sets the limit to 1MB/s. ```console export RCLONE_BWLIMIT=1M ``` -------------------------------- ### Migrate Backup Sources: Singular to Plural Keys Source: https://github.com/rustic-rs/docs/blob/main/src/breaking_changes.md Illustrates the transformation of backup source configurations from singular key names to plural ones, wrapping single values in arrays. This is necessary for compatibility with the updated configuration schema. ```toml [[backup.sources]] tag = "important" source = "~/folder1 ~/folder2" ``` ```toml [[backup.snapshots]] tags = ["important"] sources = ["~/folder1", "~/folder2"] ``` -------------------------------- ### Set Rclone Environment Variables in Rustic Profile Source: https://github.com/rustic-rs/docs/blob/main/src/FAQ.md Configure environment variables for rclone by adding them to your Rustic profile's TOML configuration file. This example sets the RCLONE_FAST_LIST variable. ```toml [global.env] RCLONE_FAST_LIST = "true" ``` -------------------------------- ### View Snapshots Source: https://github.com/rustic-rs/docs/blob/main/src/getting_started.md Lists all available snapshots for the specified host and path. It shows details like ID, time, host, and size. ```console $ rustic snapshots [INFO] using config /home/jamesvasile/.config/rustic/rustic.toml [INFO] repository local:/tmp/repo: password is correct. [INFO] using cache at /home/jamesvasile/.cache/rustic/3f64ae7425245b259ff98d1dcb6f49035af391f271da7b9ff643fd3f26408601 snapshots for (host [francium], label [], paths [src]) | ID | Time | Host | Label | Tags | Paths | Files | Dirs | Size | |---------------|---------------------|----------|-------|------|-------|-------|------|------| | 8171d606 | 2024-03-22 12:39:04 | francium | | | src | 1 | 2 | 8 B | | 27fda888 (+1) | 2024-03-22 12:55:23 | francium | | | src | 2 | 2 | 21 B | 3 snapshot(s) total: 3 snapshot(s) ``` -------------------------------- ### Initializing Target Repository During Copy Source: https://github.com/rustic-rs/docs/blob/main/src/commands/misc/copy.md Use the '--init' flag when copying snapshots to a repository for the first time to set the correct chunker parameters. This is necessary if the target repository has different chunker parameters than the source. ```console rustic copy --init --target target-profile ``` -------------------------------- ### Initial Backup Snapshot Source: https://github.com/rustic-rs/docs/blob/main/src/commands/backup/creating_snapshots.md Creates the first snapshot of a directory. The output shows the detailed process, including data scanned and added, highlighting the initial data transfer. ```console $ rustic --log-level debug backup ~/work open repository enter password for repository: password is correct lock repository load index files start scan start backup scan finished in 1.837s processed 1.720 GiB in 0:12 Files: 5307 new, 0 changed, 0 unmodified Dirs: 1867 new, 0 changed, 0 unmodified Added: 1.200 GiB snapshot 40dc1520 saved ``` -------------------------------- ### Rewrite snapshots to exclude a file Source: https://github.com/rustic-rs/docs/blob/main/src/commands/misc/rewrite.md Modifies specified snapshots to exclude files matching the glob pattern. Note that a negative glob (starting with '!') is required to specify files for removal. This command creates new snapshots tagged with 'rewrite'. ```console rustic rewrite --glob '!**/secret.env' 5109f5fe ca466029 ``` -------------------------------- ### Initialize Rustic Repository with Fixed Size Chunking Source: https://github.com/rustic-rs/docs/blob/main/src/commands/backup/blockdev.md Recommended for block devices, this command initializes a Rustic repository using fixed-size chunking with a chunk size of 1MiB. This can improve backup performance for large single files and align chunking with block boundaries. ```console rustic init --set-chunker=fixed_size --set-chunk-size=1MiB ``` -------------------------------- ### Complex Retention Policy Example Source: https://github.com/rustic-rs/docs/blob/main/src/commands/forget/remove_by_policy.md Illustrates a comprehensive retention policy combining daily, weekly, monthly, and yearly snapshot keeping. Shows how multiple '--keep-*' options are ORed, meaning a snapshot only needs to match one criterion to be kept. ```text forget --keep-daily 7 --keep-weekly 5 --keep-monthly 12 --keep-yearly 75 ``` -------------------------------- ### Initialize Repository with Extra Verification Disabled Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/intro.md Initialize a repository and disable the default extra verification step before uploading data. This can speed up the process but reduces data integrity checks. ```console rustic init --set-extra-verify=false ``` -------------------------------- ### Backup Block Device via Rustic Command Line Source: https://github.com/rustic-rs/docs/blob/main/src/commands/backup/blockdev.md Execute this command to back up a block device, setting its type to 'file' directly on the command line. ```console rustic backup --set-blockdev=file /dev/my-blockdev ``` -------------------------------- ### Initialize Repository with Custom Pack Sizes Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/intro.md Specify the target pack sizes for tree and data files during repository initialization. Larger pack sizes can improve throughput for large repositories. ```console rustic init --set-treepack-size --set-datapack-size ``` -------------------------------- ### Initialize Rustic Repository with rclone Remote Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/rclone.md Use this command to initialize a new rustic repository on a remote storage service configured with rclone. The remote and path are specified using the 'rclone::' format. ```console rustic -r rclone:foo:bar init ``` -------------------------------- ### Using Shell Commands in Hooks Source: https://github.com/rustic-rs/docs/blob/main/src/commands/misc/hooks.md Demonstrates how to use shell commands within hooks for operations like file output redirection. Commands are executed sequentially. ```toml [global.hooks] run-before = [ "sh -c 'echo Hello, > test.out'", "sh -c 'echo World! >> test.out'", ] run-after = ["sh -c 'echo Goodbye, world! >> test.out'"] ``` -------------------------------- ### Rustic Repository Configuration with Hot Storage (CLI) Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/cold_storage.md Configure Rustic to use both a cold and a hot repository using command-line arguments. The '-r' flag specifies the cold repository, and '--repo-hot' specifies the location for hot data. This is an alternative to TOML configuration. ```console rustic -r rclone:foo:cold-repo --repo-hot rclone:foo:hot-repo init ``` -------------------------------- ### Initialize Repository with Custom Pack Grow Factors Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/intro.md Configure the grow factors for tree and data pack sizes during repository initialization. This influences how pack sizes scale with repository size. ```console rustic init --set-treepack-growfactor --set-datapack-growfactor ``` -------------------------------- ### Configuring Hook Failure Handling (Method 1) Source: https://github.com/rustic-rs/docs/blob/main/src/commands/misc/hooks.md Shows how to specify the failure behavior for a hook command using the `on-failure` field within a structured TOML entry. ```toml [backup.hooks] run-after = [ { command = "notify-send", args = ["Backup finished successfully!"], on-failure = "warn" }, ] ``` -------------------------------- ### Basic REST Server URL Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/rest.md Configure the repository to use a basic HTTP REST server. ```toml [repository] repository = "rest:http://host:8000/" ``` -------------------------------- ### List all snapshots for a path Source: https://github.com/rustic-rs/docs/blob/main/src/commands/misc/rewrite.md Displays all snapshots associated with a specific path. Useful for initial state inspection. ```console rustic snapshots --all --filter-paths Project ``` -------------------------------- ### Rustic Repository Configuration with Opendal and Specific Options (TOML) Source: https://github.com/rustic-rs/docs/blob/main/src/commands/init/cold_storage.md Advanced TOML configuration for Rustic using Opendal, specifying separate options for hot and cold repositories. This allows granular control over access keys, buckets, roots, and storage classes for each part of the repository. ```toml [repository] repository = "opendal:s3" repo-hot = "opendal:s3" # options for both parts [repository.options] access_key_id = "xxx" secret_access_key = "yyy" # options only for hot part [repository.options-hot] bucket = "bucket_name_hot" root = "/path/to/repo" # options only cold part [repository.options-cold] bucket = "bucket_name_cold" root = "/path/to/repo" default_storage_class = "DEEP_ARCHIVE" ``` -------------------------------- ### Check Random Subset of Repository Pack Files by Size Source: https://github.com/rustic-rs/docs/blob/main/src/commands/misc/check.md Use '--read-data-subset=nS' to check a randomly chosen subset of pack files equivalent to a total size of 'nS' (e.g., 50M, 10G). The size is converted to a percentage of the total repository size. ```console rustic check --read-data-subset=50M rustic check --read-data-subset=10G ``` -------------------------------- ### List Available Snapshots Source: https://github.com/rustic-rs/docs/blob/main/src/commands/restore/printing_stdout.md Displays a list of available snapshots with their IDs, dates, hosts, tags, and directories. This helps in identifying the correct snapshot ID for specific file restoration. ```console $ rustic snapshots ID Date Host Tags Directory ---------------------------------------------------------------------- 562bfc5e 2018-07-14 20:18:01 mopped /home/user/file1 bbacb625 2018-07-14 20:18:07 mopped /home/other/work e922c858 2018-07-14 20:18:10 mopped /home/other/work 098db9d5 2018-07-14 20:18:13 mopped /production.sql b62f46ec 2018-07-14 20:18:16 mopped /home/user/file1 1541acae 2018-07-14 20:18:18 mopped /home/other/work ---------------------------------------------------------------------- ``` -------------------------------- ### Update Configuration for Time and Device ID Source: https://github.com/rustic-rs/docs/blob/main/src/breaking_changes.md Migrate from older `with-atime` and `ignore-devid` options to the new `set-atime` and `set-devid` settings. Ensure `set-devid` is configured appropriately for hardlinks or all files. ```toml with-atime = true ignore-devid = true ``` ```toml set-atime = "yes" set-devid = "no" ``` -------------------------------- ### Configure Block Device Backup in Rustic Config Source: https://github.com/rustic-rs/docs/blob/main/src/commands/backup/blockdev.md Use this TOML configuration to specify a block device as a backup source and set its type to 'file'. ```toml [[backup.snapshots]] sources = ["/dev/my-blockdev"] set-blockdev = "file" ``` -------------------------------- ### Copying Snapshots Between Repositories Source: https://github.com/rustic-rs/docs/blob/main/src/commands/misc/copy.md Use this command to copy all snapshots from a source repository to a destination repository. Snapshots that have already been copied will be skipped. ```console $ rustic copy --target target-profile repository d6504c63 opened successfully, password is correct repository 3dd0878c opened successfully, password is correct snapshot 410b18a2 of [/home/user/work] at 2020-06-09 23:15:57.305305 +0200 CEST) copy started, this may take a while... snapshot 7a746a07 saved snapshot 4e5d5487 of [/home/user/work] at 2020-05-01 22:44:07.012113 +0200 CEST) skipping snapshot 4e5d5487, was already copied to snapshot 50eb62b7 ```