bolt Valebyte VPS from $4/mo — NVMe, 60s deploy.

Get a VPS arrow_forward

Restic on VPS: installation, configuration, and and maintenance

calendar_month June 15, 2026 schedule 24 min read visibility 62 views
person
Valebyte Team
Restic on VPS: installation, configuration, and and maintenance

Restic on a VPS is an effective solution for creating secure, deduplicated, and encrypted backups of your data, allowing you to deploy a reliable backup system on your own server with full control over the process and minimal resource overhead.

What is Restic and why is it ideal for VPS?

Restic is a modern, fast, and efficient backup tool developed with a focus on security, deduplication, and ease of use. It is written in Go and available for most operating systems, making it a versatile solution for various scenarios. When it comes to deploying a backup system on your own server, Restic on a VPS becomes one of the most attractive options. This allows for complete control over the process, storing data where you deem appropriate, and not being dependent on third-party services with their limitations and pricing.

Key Features of Restic: Security, Efficiency, Flexibility

Restic stands out among other backup tools due to a number of unique characteristics:

  • Encryption by Default: All data is encrypted using AES-256 in GCM mode before it leaves your server. This ensures that even if someone gains access to your storage, your data remains confidential. A password is required to access the repository, which is used to generate encryption keys.
  • Data Deduplication: Restic uses smart block-level deduplication. This means it only saves the parts of files that have changed, or new blocks. If you have many similar files or multiple versions of the same file, Restic significantly saves storage space by only keeping unique blocks.
  • Snapshots: Restic creates "snapshots" of your data's state at a specific point in time. Each snapshot contains references to data blocks in the repository. This allows for easy restoration of data to any previous version without fully copying all content.
  • Multiple Backends: Restic supports a wide range of storage options for your backups: local disks, SSH, S3-compatible storage (such as MinIO, Backblaze B2, DigitalOcean Spaces), Google Cloud Storage, Azure Blob Storage, SFTP, and many others. This provides enormous flexibility when choosing a location for your backups, which is especially convenient when using your own server.
  • Integrity Check: Restic includes powerful tools for verifying repository integrity. It can check the hashes of all data blocks and metadata to ensure that your backups are not corrupted and can be restored.
  • Ease of Use: Despite its power, Restic has an intuitive command-line interface. Basic operations such as repository initialization, snapshot creation, viewing, and restoration are performed with a single command.

Advantages of Using Restic on Your Own VPS

Deploying restic self-hosted on your Virtual Private Server (VPS) offers several significant advantages:

  • Full Control: You have complete control over the infrastructure, data, and backup process. There is no dependence on third-party provider policies or failures.
  • Cost Savings: For large data volumes or frequent backups, the cost of your own VPS for Restic can be significantly lower than monthly payments for managed cloud backup services. You only pay for the resources you use.
  • Configuration Flexibility: You can configure Restic exactly as you need it, integrate it with other tools on your server, such as the Netdata monitoring system, or use specific storage types.
  • Data Security: Restic's end-to-end encryption combined with the physical security of your VPS (provided by your hosting provider) gives confidence in the safety of your data.
  • Privacy: Your data remains yours. No one but you has access to unencrypted backups.

System Requirements and Preliminary VPS Preparation for Restic Installation

Before proceeding with restic installation on your VPS, it's important to ensure that the server meets the minimum requirements and is properly prepared. This will ensure stable and efficient operation of the backup system.

VPS requirements for Restic depend on the data volume, backup frequency, and storage type. Restic itself is quite lightweight, but the data processing (encryption, deduplication, compression) requires resources.

Minimum Configuration (for small data volumes, up to 100 GB, infrequent backups):

  • CPU: 1 vCPU (2.0+ GHz)
  • RAM: 1 GB
  • Disk: 20 GB NVMe (for OS and Restic temporary files). Backup storage volume depends on the chosen backend (local disk or external object storage).
  • Network bandwidth: 100 Mbps
  • OS: Ubuntu 22.04 LTS, Debian 12, CentOS 9 (or similar)

Recommended Configuration (for medium data volumes, 100 GB - 1 TB, regular backups):

  • CPU: 2 vCPU (2.5+ GHz)
  • RAM: 2-4 GB
  • Disk: 40-80 GB NVMe (for OS and Restic temporary files).
  • Network bandwidth: 1 Gbps
  • OS: Ubuntu 22.04 LTS, Debian 12 (or similar)

For large data volumes (over 1 TB) or very frequent backups:

  • CPU: 4+ vCPU
  • RAM: 8+ GB
  • Disk: 100+ GB NVMe (for OS and Restic temporary files) with high IOPS.
  • Network bandwidth: 1 Gbps or higher (preferably with unlimited traffic).

It's important to remember that Restic actively uses RAM and disk I/O during backup and prune operations, especially when working with large repositories or deduplicating large files. NVMe disks significantly speed up these processes.

Operating System Preparation: Update and Basic Utilities

After gaining access to your VPS, the first step is to update the system and install basic utilities that will be needed for further work.

1. Connect via SSH:

Use an SSH client to connect to your server. Replace your_user with your username (usually root or admin) and your_vps_ip with your VPS's IP address.

ssh your_user@your_vps_ip

2. Update the system:

Always start by updating packages and the system to ensure you have the latest software versions and security patches.

sudo apt update && sudo apt upgrade -y
sudo apt autoremove -y

(For CentOS/RHEL, use sudo yum update -y or sudo dnf update -y)

3. Install basic utilities:

Install a few useful utilities that may come in handy during setup and administration.

sudo apt install -y curl wget git nano htop screen unzip

(For CentOS/RHEL, use sudo yum install -y curl wget git nano htop screen unzip)

4. Configure Firewall (UFW):

It is important to configure a firewall to protect your server. By default, allow SSH, and then, if you plan to use a web interface for Restic (although Restic itself is a CLI tool, you can use it with web interfaces like Restic-Browser or RESTic-GUI, or for accessing a backend if it's web-oriented), allow HTTP/HTTPS.

sudo apt install -y ufw
sudo ufw allow OpenSSH
sudo ufw allow http
sudo ufw allow https
sudo ufw enable
sudo ufw status

Make sure SSH is allowed before enabling UFW, otherwise you risk losing access to the server.

Looking for a reliable server for your projects?

VPS from $10/month and dedicated servers from $9/month with NVMe, DDoS protection, and 24/7 support.

View offers →

Step-by-Step Restic Installation on VPS with Docker and Docker Compose

Using Docker for Restic installation provides an isolated and easily manageable environment. This is especially convenient for restic docker deployments, as it avoids dependency conflicts and simplifies updates.

Installing Docker and Docker Compose

If Docker and Docker Compose are not yet installed on your VPS, follow these steps.

1. Install Docker Engine:

The official Docker installation script is the easiest way. It automatically detects your OS and installs the necessary packages.

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

Add your user to the docker group to run Docker commands without sudo (requires re-logging in).

sudo usermod -aG docker $USER
newgrp docker

Check Docker installation:

docker run hello-world

2. Install Docker Compose:

Docker Compose is installed as a separate binary. Make sure you are using the latest stable version. You can check the current version on the Docker Compose releases page.

sudo curl -L "https://github.com/docker/compose/releases/download/v2.24.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

Check Docker Compose installation:

docker-compose --version

Deploying Restic via Docker Compose: Example Configuration

For restic on a server via Docker Compose, we will create a simple project that allows running Restic commands from a container. This is convenient because the container will have all the necessary dependencies and isolation. We will not run Restic as a continuously running service, but will use it to execute commands on a schedule.

1. Create project structure:

mkdir -p ~/restic-backup
cd ~/restic-backup

2. Create docker-compose.yml file:

This file will define our Restic service. Note the volume mounts: /source_data will contain the data to be backed up, and /restic_repo will be where Restic stores its repository (or connects to external storage).

version: '3.8'

services:
  restic:
    image: restic/restic:latest
    container_name: restic_client
    volumes:
      # Replace /path/to/your/actual/data with the path to the data you want to back up on your VPS
      - /opt/my_app_data:/source_data:ro
      # Replace /path/to/restic/repo with the path where the Restic repository will be stored on your VPS
      # Or it can be an empty directory if you are using a cloud backend
      - /mnt/restic_repo:/restic_repo
      # Directory for Restic temporary files
      - /tmp/restic_temp:/tmp
    environment:
      # Be sure to replace with your strong password!
      - RESTIC_PASSWORD=YourStrongResticPasswordHere
      # If using S3-compatible storage
      # - AWS_ACCESS_KEY_ID=YOUR_S3_ACCESS_KEY
      # - AWS_SECRET_ACCESS_KEY=YOUR_S3_SECRET_KEY
      # - RESTIC_REPOSITORY=s3:https://s3.your-region.amazonaws.com/your-bucket-name
      # Example for a local repository
      - RESTIC_REPOSITORY=/restic_repo
    # Set working directory for convenient command execution
    working_dir: /source_data
    # Stop the container after command execution, as it should not run continuously
    # Commands will be executed manually or via cronjob
    command: ["/bin/true"] # Placeholder, the container will be launched with specific commands

Save this file as docker-compose.yml in the ~/restic-backup directory.

Important notes on configuration:

  • image: restic/restic:latest: Uses the official Restic image. :latest will always pull the newest version. For production, it's better to specify a concrete version (e.g., restic/restic:0.16.4) for stability.
  • volumes:
    • /opt/my_app_data:/source_data:ro: This is an example. /opt/my_app_data is the path on your host VPS where the data you want to back up is located (e.g., web server files, databases). /source_data is the path inside the container. :ro means "read-only" to prevent Restic from accidentally modifying the source data.
    • /mnt/restic_repo:/restic_repo: This is the path on the host VPS where your Restic repository will be stored. You can change it to any other location, for example, an external disk or network storage. If you are using cloud storage (S3, B2, etc.), this volume can simply be a temporary directory, or not needed at all if Restic doesn't require a local cache.
    • /tmp/restic_temp:/tmp: Restic uses /tmp for temporary files. It is recommended to allocate a separate volume for this or ensure that /tmp has sufficient space and performance.
  • environment:
    • RESTIC_PASSWORD: It is extremely important to use a strong, unique password. Never use the default password. It is recommended to use Docker environment variables for such secrets.
    • RESTIC_REPOSITORY: Defines where Restic will store backups. The example specifies a local path /restic_repo inside the container (which is mounted to the host system). For S3-compatible storage, this would be something like s3:https://s3.your-region.amazonaws.com/your-bucket-name, and then additional AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY variables would be required.

Before running Restic, ensure that the directories /opt/my_app_data and /mnt/restic_repo exist on your host VPS.

sudo mkdir -p /opt/my_app_data
sudo mkdir -p /mnt/restic_repo

If you are using other applications on your VPS, such as Filebrowser, Syncthing, or Seafile, make sure you correctly specify the paths to their data for backup.

rocket_launch Quick pick

Need a dedicated server?

Compare prices from top providers. Configure and order in minutes.

Browse dedicated servers arrow_forward

Configuring Restic to Create and Manage Backups

Once the Docker Compose file is ready, you can proceed with initializing the repository and creating the first backups. All commands will be executed via docker-compose run restic ..., which ensures the container with the correct settings is used.

Repository Initialization and Password Management

The first step after configuring is to initialize the Restic repository. This creates the necessary structure for storing your backups.

docker-compose run --rm restic init

This command will initialize the repository using RESTIC_REPOSITORY and RESTIC_PASSWORD defined in docker-compose.yml. The --rm parameter ensures that the container is removed after the command execution.

Important: The Restic repository password is the only key to your encrypted data. Losing this password will result in the irreversible loss of all backups. Write it down in a secure place (e.g., a password manager). Never store it in plain text on the server, except as Docker Compose environment variables, which in turn must be protected by access rights.

Creating the First Backup and Integrity Check

After initializing the repository, you can create the first snapshot of your data.

1. Create the first backup:

Navigate to the directory where your docker-compose.yml is located, and execute:

docker-compose run --rm restic backup . --exclude-file /source_data/exclude.txt

Here:

  • backup .: Instructs Restic to back up the current working directory of the container (which we mounted as /source_data).
  • --exclude-file /source_data/exclude.txt: Allows you to specify a file with a list of paths to exclude from the backup. Create an exclude.txt file in /opt/my_app_data on your VPS (or wherever you mounted as /source_data) and add paths (one per line) that should not be backed up (e.g., caches, logs, temporary files).

Example content of /opt/my_app_data/exclude.txt:

# Exclude logs
*.log
logs/

# Exclude temporary files
tmp/
temp/
*.tmp

# Exclude caches
cache/
.cache/

# Exclude Restic repository if it accidentally ended up inside
/restic_repo

Restic will show the backup progress, including the number of files processed, data size, and execution time.

2. View created snapshots:

docker-compose run --rm restic snapshots

This command will display a list of all snapshots stored in your repository, with their ID, date, size, and source path.

3. Check repository integrity:

Regularly checking repository integrity is a critically important practice to confirm that your backups are in order and can be restored. Restic offers the check command for this.

docker-compose run --rm restic check

This command checks the repository structure and the integrity of data blocks. For a deeper check that reads all data and verifies its hashes, use --read-data (this can take a long time and require significant resources):

docker-compose run --rm restic check --read-data

Scheduling Automatic Backups with Cron or systemd

Automating backups is key to a reliable system. You can use Cron or systemd timers for this.

1. Automation with Cron:

Cron is the standard task scheduler in Linux. Open crontab for editing:

crontab -e

Add a line for daily backup, for example, at 03:00 AM:

0 3 * * * cd /home/your_user/restic-backup && docker-compose run --rm restic backup . --exclude-file /source_data/exclude.txt >> /var/log/restic_backup.log 2>&1

Be sure to replace /home/your_user/restic-backup with the actual path to your Restic Docker Compose directory. You can also add a command to check the repository:

0 4 * * 7 cd /home/your_user/restic-backup && docker-compose run --rm restic check >> /var/log/restic_check.log 2>&1

This command will run every Sunday at 04:00 AM.

2. Deleting old snapshots (Prune) and optimization:

Restic stores multiple versions of files. Over time, the repository can grow. The prune command removes unused data blocks and optimizes the repository according to a specified policy. Use forget before prune to determine which snapshots to remove.

# Example policy: keep the last 7 daily snapshots, 4 weekly, 12 monthly, and 1 yearly.
# This should be run after each backup, or on a separate schedule.
docker-compose run --rm restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --keep-yearly 1 --prune

Add this command to your crontab after the backup or on a separate schedule, for example, once a week:

30 3 * * * cd /home/your_user/restic-backup && docker-compose run --rm restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --keep-yearly 1 --prune >> /var/log/restic_prune.log 2>&1

This command will run daily at 03:30 AM. The forget policy is very flexible; refer to the Restic documentation for more fine-grained configuration.

Securing Access: Reverse Proxy (Nginx/Caddy) and HTTPS

While Restic is a CLI tool and does not provide its own web interface, the concept of a reverse proxy and HTTPS becomes relevant if you use Restic with web interfaces (e.g., Restic-Browser, Restic-GUI, which can be deployed on your VPS) or if your backend for storing backups is accessible via HTTP/S (e.g., MinIO, deployed on the same server). In such a case, ensuring secure access to these components via HTTPS using a reverse proxy is mandatory.

Why Do You Need a Reverse Proxy for Restic?

A reverse proxy server is a server that accepts requests from clients, forwards them to one or more internal servers, and then returns the response to the client. For Restic and its associated web interfaces, a reverse proxy performs several important functions:

  • TLS/SSL Termination (HTTPS): A reverse proxy can handle SSL certificates and encryption (HTTPS), offloading this task from the main application and ensuring a secure connection between the client and the server.
  • Single Point of Entry: You can use a single domain (e.g., backup.yourdomain.com) to access multiple internal services that may be running on different ports.
  • Load Balancing: Although not as critical for Restic, a reverse proxy can distribute traffic among multiple application instances.
  • Additional Layer of Security: A reverse proxy can filter malicious traffic, hide the internal structure of your network, and provide basic authentication.

We will cover the setup of two popular reverse proxies: Nginx and Caddy. It is assumed that you already have a domain name pointing to your VPS's IP address.

Configuring Nginx for Restic

Nginx is a high-performance web server and reverse proxy. If you are already using Nginx for other services (e.g., for CapRover or other applications), it is easy to configure it for Restic-related components as well.

1. Install Nginx:

sudo apt install -y nginx

2. Configure Firewall:

sudo ufw allow 'Nginx Full'
sudo ufw delete allow 'Nginx HTTP' # If you previously only allowed HTTP

3. Obtain an SSL certificate with Let's Encrypt (Certbot):

sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d backup.yourdomain.com

Follow the Certbot instructions. It will automatically configure Nginx to use HTTPS.

4. Create an Nginx configuration file for Restic (or a related web interface):

Create a new configuration file in /etc/nginx/sites-available/, for example, restic-ui.conf:

sudo nano /etc/nginx/sites-available/restic-ui.conf

Example configuration for Restic-Browser running on port 8080:

server {
    listen 80;
    listen [::]:80;
    server_name backup.yourdomain.com;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name backup.yourdomain.com;

    ssl_certificate /etc/letsencrypt/live/backup.yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/backup.yourdomain.com/privkey.pem;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_prefer_server_ciphers on;
    ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384";
    ssl_stapling on;
    ssl_stapling_verify on;
    add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
    add_header X-Frame-Options DENY;
    add_header X-Content-Type-Options nosniff;
    add_header X-XSS-Protection "1; mode=block";

    location / {
        proxy_pass http://localhost:8080; # Port where your Restic UI/backend is running
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 900; # Increase timeout for large backups
    }
}

Replace backup.yourdomain.com with your subdomain and http://localhost:8080 with the actual address of your service.

5. Activate configuration and restart Nginx:

sudo ln -s /etc/nginx/sites-available/restic-ui.conf /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx

Configuring Caddy for Restic

Caddy is a modern web server with automatic HTTPS (thanks to Let's Encrypt). It is much simpler to configure than Nginx, especially for obtaining certificates.

1. Install Caddy:

sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy

2. Configure Firewall:

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

3. Create a Caddyfile:

Create or edit the /etc/caddy/Caddyfile file:

sudo nano /etc/caddy/Caddyfile

Add the following configuration (replace backup.yourdomain.com and port):

backup.yourdomain.com {
    reverse_proxy localhost:8080 # Port where your Restic UI/backend is running
    # Additional security settings (optional)
    header {
        Strict-Transport-Security "max-age=31536000; includeSubDomains"
        X-Frame-Options DENY
        X-Content-Type-Options nosniff
        X-XSS-Protection "1; mode=block"
    }
}

Caddy will automatically obtain and renew SSL certificates for backup.yourdomain.com.

4. Check and restart Caddy:

sudo caddy validate --config /etc/caddy/Caddyfile
sudo systemctl restart caddy

Now your Restic-related web service will be accessible via HTTPS through the specified domain.

Restic Maintenance: Monitoring, Updates, and Data Recovery

A successful backup system is not just about installation and configuration, but also regular maintenance. Monitoring, timely updates, and, of course, the ability to restore data are key aspects of restic vps reliability.

Monitoring Repository and Backup Status

Regularly checking backup status and repository health is critically important. If backups are not working, you will only find out when it's too late.

1. Check Cron logs:

If you have configured backups via Cron, make sure logs are being generated and do not contain errors.

tail -f /var/log/restic_backup.log
tail -f /var/log/restic_check.log
tail -f /var/log/restic_prune.log

2. Check Restic repository status:

Use the stats command to get information about the repository size, number of files, and snapshots.

docker-compose run --rm restic stats --mode restore-size
docker-compose run --rm restic stats --mode raw-data
docker-compose run --rm restic stats --mode repo-size

restore-size will show the size of data that will be restored, raw-data – the total size of the source data, repo-size – the actual size occupied by the repository after deduplication and compression.

3. Status notifications:

Integrate Restic with a notification system. There are several ways:

  • Shell scripts: Wrap Restic commands in a script that sends an email or a message to Slack/Telegram (via curl and respective APIs) in case of success or error.
  • Healthchecks.io or UptimeRobot: Use these services to ping a URL after a successful backup. If the ping doesn't arrive at the expected time, you will receive a notification.
  • Log monitoring: Use tools for centralized log collection (e.g., ELK Stack, Grafana Loki) and set up alerts based on error keywords.

Example of a simple backup script with notification (backup_script.sh):

#!/bin/bash

LOG_FILE="/var/log/restic_backup.log"
DATE=$(date +"%Y-%m-%d %H:%M:%S")
PROJECT_DIR="/home/your_user/restic-backup" # Specify your path

echo "--- Restic Backup Started: $DATE ---" >> $LOG_FILE 2>&1

cd $PROJECT_DIR && docker-compose run --rm restic backup . --exclude-file /source_data/exclude.txt >> $LOG_FILE 2>&1
BACKUP_STATUS=$?

if [ $BACKUP_STATUS -eq 0 ]; then
    echo "Restic Backup SUCCESS at $DATE" >> $LOG_FILE
    # Send success notification (e.g., to Telegram)
    # curl -s -X POST https://api.telegram.org/botYOUR_BOT_TOKEN/sendMessage -d chat_id=YOUR_CHAT_ID -d text="Restic Backup SUCCESS for VPS at $DATE"
else
    echo "Restic Backup FAILED at $DATE" >> $LOG_FILE
    # Send error notification
    # curl -s -X POST https://api.telegram.org/botYOUR_BOT_TOKEN/sendMessage -d chat_id=YOUR_CHAT_ID -d text="Restic Backup FAILED for VPS at $DATE. Check logs: $LOG_FILE"
fi

echo "--- Restic Prune Started: $DATE ---" >> $LOG_FILE 2>&1
cd $PROJECT_DIR && docker-compose run --rm restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --keep-yearly 1 --prune >> $LOG_FILE 2>&1
PRUNE_STATUS=$?

if [ $PRUNE_STATUS -eq 0 ]; then
    echo "Restic Prune SUCCESS at $DATE" >> $LOG_FILE
else
    echo "Restic Prune FAILED at $DATE" >> $LOG_FILE
fi

echo "--- Restic Job Finished: $DATE ---" >> $LOG_FILE 2>&1

Make the script executable (chmod +x backup_script.sh) and call it from Cron.

Updating Restic and Docker Images

Regularly updating Restic and Docker images is important for new features, bug fixes, and security patches.

1. Update Restic Docker image:

To update the Restic image, simply run the pull command for your image, and then Docker Compose will use the new version on the next run.

cd ~/restic-backup
docker-compose pull restic

If you are using a specific image version (e.g., restic/restic:0.16.4), you will need to update the version in docker-compose.yml before running pull.

2. Update Docker Engine and Docker Compose:

For Docker Engine and Docker Compose, follow the official documentation. This is usually done via the package manager:

sudo apt update
sudo apt upgrade docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

Restoring Data with Restic

A backup is useless if you cannot restore the data. Restic makes the restoration process simple and flexible.

1. View available snapshots:

docker-compose run --rm restic snapshots

You will see a list of snapshots with their IDs. Select the ID of the snapshot you want to restore.

2. Restore data to a specified directory:

Restore data from the selected snapshot to a new directory to avoid overwriting existing data.

sudo mkdir -p /tmp/restored_data
docker-compose run --rm \
    -v /tmp/restored_data:/restore_target \
    restic restore latest --target /restore_target

Here:

  • -v /tmp/restored_data:/restore_target: Mounts the host directory /tmp/restored_data as /restore_target inside the container.
  • restore latest: Restores the most recent snapshot. You can replace latest with a specific snapshot ID to restore a particular version.
  • --target /restore_target: Instructs Restic to restore data to this directory inside the container (which will then be available on your VPS in /tmp/restored_data).

3. Restore specific files or directories:

You can restore only a portion of a snapshot by specifying the path to the file or directory.

sudo mkdir -p /tmp/restored_data
docker-compose run --rm \
    -v /tmp/restored_data:/restore_target \
    restic restore latest --target /restore_target --include /source_data/path/to/specific_file.txt

Replace /source_data/path/to/specific_file.txt with the path to the file or directory you want to restore, relative to the root of your backup (/source_data).

Always test the restoration process! Regularly perform trial restorations to ensure your backups are working and you know how to quickly recover data if needed. This can be just as important as the backup process itself.

rocket_launch Quick pick

Need a dedicated server?

Compare prices from top providers. Configure and order in minutes.

Browse dedicated servers arrow_forward

Choosing the Optimal VPS Config for Restic Under Real Load

Choosing the right VPS for Restic is critically important for ensuring the performance and reliability of your backup system. The configuration depends on several factors: data volume, backup frequency, type of data stored, and the chosen backend.

Factors Affecting Restic Performance

1. Data Volume: Obviously, the more data you back up, the more time and resources it will require. Restic handles large volumes well due to deduplication, but the first full backup will be the most resource-intensive.

2. Number of Files: Restic spends time scanning the file system and processing metadata for each file. Backing up 1 TB of data consisting of millions of small files can be slower than backing up 1 TB consisting of a few large files, even with the same total volume.

3. Disk Type: NVMe drives are significantly faster than traditional SSDs and HDDs, especially when dealing with a large number of small files or intensive I/O, which is characteristic of Restic's deduplication and integrity check operations. Choosing a VPS with NVMe drives from Valebyte.com will ensure maximum performance.

4. Processor (CPU): Encryption, deduplication, and data compression are resource-intensive operations that actively use the CPU. The more powerful the processor, the faster Restic will process data.

5. Random Access Memory (RAM): Restic uses RAM for caching data blocks and repository metadata. For very large repositories (tens and hundreds of terabytes), a significant amount of RAM (8 GB or more) may be required for the prune or check --read-data commands.

6. Network Bandwidth: If you are backing up data to a remote backend (S3, Backblaze B2, etc.), your internet connection speed will be a limiting factor. High-speed ports (1 Gbps) at Valebyte.com will help speed up the process.

7. Server and Repository Location: If your data source and Restic repository are on the same VPS, or on a VPS in the same data center, this minimizes latency. If backups are sent to a remote server over the internet, ping and network bandwidth will play a larger role.

Recommendations for Choosing a Valebyte.com Plan

Valebyte.com offers various VPS configurations that are suitable for different Restic use cases. Below is a table with recommendations:

Use Case Data Volume (source) vCPU RAM Disk (NVMe) Example Valebyte.com Plan Estimated Cost/Month
Personal/Small Business
(Website, small DBs, documents)
Up to 100 GB 1 1-2 GB 20-40 GB VPS-1 (1 vCPU, 2 GB RAM, 40 GB NVMe) From $5-$10
Medium Business/Development
(Multiple applications, medium DBs, VM images)
100 GB - 1 TB 2-4 4-8 GB 80-160 GB VPS-2 (2 vCPU, 4 GB RAM, 80 GB NVMe) From $15-$30
Large Business/Enterprise
(Large DBs, file storage, multiple servers)
1 TB and more 4-8+ 8-16+ GB 200+ GB VPS-3 (4 vCPU, 8 GB RAM, 160 GB NVMe) From $40-$80+

Additional Recommendations:

  1. Start with a buffer: It's better to choose a VPS with a small resource buffer than to face shortages at a critical moment. You can always scale your plan later.
  2. NVMe Drives: Always prioritize VPS with NVMe drives. This is one of the most important improvements for Restic's performance.
  3. Resource Monitoring: Use tools like htop, Netdata, or Prometheus/Grafana to monitor CPU, RAM, and disk I/O usage during Restic operations. This will help you understand if you have enough resources.
  4. Testing: Conduct test backups and restorations on your chosen configuration to evaluate real-world performance.
  5. Restic Backend: If you are using the local VPS disk to store the Restic repository, ensure you have enough space. For large data volumes, consider using remote S3-compatible storage (e.g., Backblaze B2, DigitalOcean Spaces) or a separate VPS with a large disk for a "backup server" role.

The correct choice of VPS configuration from Valebyte.com will allow you to create a reliable, fast, and cost-effective Restic-based backup system that will effectively protect your data.

Conclusion

Restic on a VPS represents a powerful, secure, and cost-effective solution for data backup, providing full control over your backups. By using Docker Compose, you get a flexible and easily manageable environment for restic installation, and the right choice of VPS configuration from Valebyte.com ensures high performance and system reliability.

Ready to choose a server?

VPS and dedicated servers in 72+ countries with instant activation and full root access.

Start now →
support_agent
Valebyte Support
Usually replies within minutes
Hi there!
Send us a message and we'll reply as soon as possible.