Skip to content

Guide

Back up Linux to UK S3 with rclone and restic

Published · 8 min read

Short answer

Use rclone when you want a plain copy of files in a bucket, and restic when you want proper backups: encrypted before they leave the server, deduplicated, with many restore points and a retention policy. Both work with any S3-compatible service once you give them the endpoint, region, bucket and an access key. For restic, set the repository to s3: followed by the endpoint address and bucket, keep the repository password somewhere outside the server, run restic forget --prune on a schedule and test a restore.

Off-site storage in London for these backups. See how and what it costs

rclone or restic?

rclone and restic compared for server backups
rclonerestic
What lands in the bucketYour files as they are, readable with any S3 toolAn encrypted repository that only restic can read
EncryptionOptional, with a separate crypt remoteAlways on, with your repository password
Restore pointsOne copy (the latest), unless you arrange moreMany snapshots, kept by your retention rules
Best forMirroring a folder, moving data, sharing exports with your own appsBackups you may need to roll back to a date

Many people use both: restic for the server's backups, rclone for one-off copies and migrations.

What you need from your storage

  • The endpoint address and the region name to use. In the commands below they are YOUR_ENDPOINT and YOUR_REGION.
  • A bucket, created in your storage panel. Below it is YOUR_BUCKET.
  • An access key and secret key. Below they are YOUR_ACCESS_KEY and YOUR_SECRET_KEY.

With WharfCloud UK Object Storage all four are shown in your panel. Keep the secret key out of shell history and out of Git: the files below are readable by root only.

rclone: copy files to a bucket

Install rclone from your distribution (sudo apt install rclone) or from rclone.org for a newer version. Then add a remote to /root/.config/rclone/rclone.conf. For an S3-compatible service that has no preset in rclone, the provider is Other:

[ukstore]
type = s3
provider = Other
access_key_id = YOUR_ACCESS_KEY
secret_access_key = YOUR_SECRET_KEY
endpoint = https://YOUR_ENDPOINT
region = YOUR_REGION
no_check_bucket = true

no_check_bucket = true stops rclone trying to create the bucket, which you have already made in the panel. Always name the bucket: listing every bucket on the account is not available, so rclone lsd ukstore: on its own shows nothing. Then copy and check:

rclone lsd ukstore:YOUR_BUCKET
rclone copy /srv/exports ukstore:YOUR_BUCKET/exports --progress
rclone check /srv/exports ukstore:YOUR_BUCKET/exports

restic: encrypted backups with restore points

Install restic (sudo apt install restic, then sudo restic self-update for the latest release). Put the settings in a file only root can read, for example /root/restic.env:

export AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY
export AWS_SECRET_ACCESS_KEY=YOUR_SECRET_KEY
export AWS_DEFAULT_REGION=YOUR_REGION
export RESTIC_REPOSITORY=s3:https://YOUR_ENDPOINT/YOUR_BUCKET/server1
export RESTIC_PASSWORD_FILE=/root/.restic-password

Create a long random password in /root/.restic-password, then create the repository and take a first backup:

chmod 600 /root/restic.env
openssl rand -base64 32 > /root/.restic-password && chmod 600 /root/.restic-password
. /root/restic.env
restic init
restic backup /etc /srv /home --exclude-caches
restic snapshots

Databases should be dumped to a file first (for example with pg_dump or mysqldump) and that file backed up, rather than copying live database files.

Schedule it and keep storage in check

A nightly job that backs up, applies your retention rules and checks the repository is enough for most servers. As root, crontab -e:

15 2 * * * . /root/restic.env && restic backup /etc /srv /home --exclude-caches --quiet && restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --prune --quiet
30 4 * * 0 . /root/restic.env && restic check --quiet

forget removes snapshots outside the rules and --prune frees the space they used. Without pruning, the repository only grows. Make sure a failed run reaches a person: send cron's output to an address someone reads, or ping a heartbeat monitor at the end of the job.

Size your storage for the retention you keep, not just one copy. On WharfCloud UK Object Storage you get an email at 80% of your package and again when it is full, and uploads stop if you stay above 110% for 7 days.

Test a restore

A backup you have never restored is a hope, not a plan. Restore to a scratch folder and compare:

. /root/restic.env
restic restore latest --target /tmp/restore-test --include /etc/hostname
restic mount /mnt/restic

restic mount (with FUSE installed) shows every snapshot as a folder, which makes it easy to pick out a single file. Try a full restore onto a spare server once a year and time it.

Sources

Facts were checked against these sources on 3 December 2026. Vendor terms change; check the source before relying on a detail.

FAQ

Frequently asked questions

Does restic work with any S3-compatible storage?

Yes. Give restic a repository address made of s3: and the endpoint address, followed by the bucket name, set the access key and secret key in the usual AWS environment variables, and set the region in AWS_DEFAULT_REGION. For services other than Amazon it uses path-style bucket addresses by default.

Is rclone a backup tool?

It is a copy and sync tool. It can be part of a backup if you copy to dated folders or keep versions another way, but on its own a synced mirror also mirrors deletions and ransomware damage.

Is the data encrypted?

restic encrypts everything on the server before it is sent, with your repository password. rclone sends files as they are over HTTPS, unless you add an rclone crypt remote.

Off-site storage in London for these backups

UK Object Storage: UK Object Storage, from £3/month. Not sure which fits? Ask an engineer; we reply in UK business hours.