Elfatih Blog

Restic - MinIO Backup

Table of contents

What is Restic?

Restic is a backup program that is fast, efficient and secure. It supports the three major operating systems (Linux, macOS, Windows).

For more information refer to:

line

What is MinIO?

MinIO is a high-performance, S3 compatible object storage. MinIO released under GNU Affero General Public License v3.0. It is API compatible with the Amazon S3 cloud storage service. It is capable of working with unstructured data such as photos, videos, log files, backups, and container images with a maximum supported object size of 50TB.

For more information refer to:

High Performance Object Storage for Modern Data Lakes.

MinIO is a high-performance, S3 compatible object store. It is built for large scale AI/ML, data lake and database workloads. It is software-defined and runs on any cloud or on-premises infrastructure. MinIO is dual-licensed under open source GNU AGPL v3 and a commercial enterprise license.

For more information refer to:

line

Install Restic in Windows using scoop

First install scoop from the PoweShell:

PS C:\Users\Administrator> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
PS C:\Users\Administrator> irm get.scoop.sh | iex
Initializing...
Downloading ...
Creating shim...
Adding ~\scoop\shims to your path.
Scoop was installed successfully!
Type 'scoop help' for instructions.

PS C:\Users\Administrator> S

scoop help

PS C:\Users\Administrator> scoop search python
Results from local buckets...

Name      Version  Source Binaries
----      -------  ------ --------
python    3.12.0   main           
winpython 3.11.5.0 main 
PS C:\Users\Administrator> scoop search restic
Results from local buckets...

Name          Version Source Binaries
----          ------- ------ --------
restic        0.16.2  main           
resticprofile 0.24.0  main
PS C:\Users\Administrator> scoop install restic
Installing 'restic' (0.16.2) [64bit] from main bucket
Downloading https://github.com/restic/restic/releases/download/v0.16.2/restic_0.16.2_windows_amd64.zip (8.7 MB)...
Checking hash of restic_0.16.2_windows_amd64.zip ... ok.
Extracting restic_0.16.2_windows_amd64.zip ... done.
Running pre_install script...
Linking ~\scoop\apps\restic\current => ~\scoop\apps\restic\0.16.2
Creating shim for 'restic'.
'restic' (0.16.2) was installed successfully!

line

Install restic in Linux

sudo apt install restic

line

How to use restic in Windows

PS C:\Users\Administrator> restic help

restic is a backup program which allows saving multiple revisions of files and
directories in an encrypted repository stored on different backends.

The full documentation can be found at https://restic.readthedocs.io/ .

Usage:
  restic [command]

Available Commands:
  backup        Create a new backup of files and/or directories
  cache         Operate on local cache directories
  cat           Print internal objects to stdout
  check         Check the repository for errors
  copy          Copy snapshots from one repository to another
  diff          Show differences between two snapshots
  dump          Print a backed-up file to stdout
  find          Find a file, a directory or restic IDs
  forget        Remove snapshots from the repository
  generate      Generate manual pages and auto-completion files (bash, fish, zsh, powershell)
  help          Help about any command
  init          Initialize a new repository
  key           Manage keys (passwords)
  list          List objects in the repository
  ls            List files in a snapshot
  migrate       Apply migrations
  prune         Remove unneeded data from the repository
  recover       Recover data from the repository not referenced by snapshots
  repair        Repair the repository
  restore       Extract the data from a snapshot
  rewrite       Rewrite snapshots to exclude unwanted files
  self-update   Update the restic binary
  snapshots     List all snapshots
  stats         Scan the repository and show basic statistics
  tag           Modify tags on snapshots
  unlock        Remove locks other processes created
  version       Print version information

Flags:
      --cacert file                file to load root certificates from (default: use system certificates or $RESTIC_CACERT)
      --cache-dir directory        set the cache directory. (default: use system default cache directory)
      --cleanup-cache              auto remove old cache directories
      --compression mode           compression mode (only available for repository format version 2), one of (auto|off|max) (default: $RESTIC_COMPRESSION) (default au
to)
  -h, --help                       help for restic
      --insecure-tls               skip TLS certificate verification when connecting to the repository (insecure)
      --json                       set output mode to JSON for commands that support it
      --key-hint key               key ID of key to try decrypting first (default: $RESTIC_KEY_HINT)
      --limit-download rate        limits downloads to a maximum rate in KiB/s. (default: unlimited)
      --limit-upload rate          limits uploads to a maximum rate in KiB/s. (default: unlimited)
      --no-cache                   do not use a local cache
      --no-lock                    do not lock the repository, this allows some operations on read-only repositories
  -o, --option key=value           set extended option (key=value, can be specified multiple times)
      --pack-size size             set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
      --password-command command   shell command to obtain the repository password from (default: $RESTIC_PASSWORD_COMMAND)
  -p, --password-file file         file to read the repository password from (default: $RESTIC_PASSWORD_FILE)
  -q, --quiet                      do not output comprehensive progress report
  -r, --repo repository            repository to backup to or restore from (default: $RESTIC_REPOSITORY)
      --repository-file file       file to read the repository location from (default: $RESTIC_REPOSITORY_FILE)
      --retry-lock duration        retry to lock the repository if it is already locked, takes a value like 5m or 2h (default: no retries)
      --tls-client-cert file       path to a file containing PEM encoded TLS client certificate and private key (default: $RESTIC_TLS_CLIENT_CERT)
  -v, --verbose                    be verbose (specify multiple times or a level using --verbose=n, max level/times is 2)

Use "restic [command] --help" for more information about a command.

line

Create env “addenv.bat” batch file for restic

C:\bin\restic>notepad addemvi.bat
set AWS_ACCESS_KEY_ID=fatih
set AWS_SECRET_ACCESS_KEY=StrongSecret
set RESTIC_PASSWORD=StrongPassword
set TMPDIR=c:\temp\restic\temp
set TMP=c:\temp\restic\temp

line

Create restic repository

C:\bin\restic>restic -r s3:http://192.168.1.10/ek-desktop init

created restic repository 574248f480 at s3:192.168.1.10:9555:9555/ek-desktop
Please note that knowledge of your password is required to access
the repository. Losing your password means that your data is
irrecoverably lost.

line

Backup folder to the repository

C:\Users\Administrator\Desktop\ek-personal
cd ~\Desktop\ek-personal
restic -r s3:http://192.168.1.10:9555/ek-desktop --verbose backup C:\Users\Administrator\Desktop\ek-personal

line

Create a repo

restic -r s3:http://192.168.1.10:9555/ek-desktop init
mc alias set myminio https://minioserver.example.net ACCESS_KEY SECRET KEY
mc alias set myminio https://s3.example.net:9555 fatih StrongPassword
mc alias set myminio https://192.168.1.10:9555 fatih StrongPassword

line

Access Key Example

fatih Access Key:

0S01hWKZqcRGytv966

Secret Key:

H21CxuzPItT0U9UsIxxIyBJIPqD8sWw7kf

line

Follow me

ELFATIH KHALID (Eng., MSc.) | Cyber Security Advisor