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 | restic | |
|---|---|---|
| What lands in the bucket | Your files as they are, readable with any S3 tool | An encrypted repository that only restic can read |
| Encryption | Optional, with a separate crypt remote | Always on, with your repository password |
| Restore points | One copy (the latest), unless you arrange more | Many snapshots, kept by your retention rules |
| Best for | Mirroring a folder, moving data, sharing exports with your own apps | Backups 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_ENDPOINTandYOUR_REGION. - A bucket, created in your storage panel. Below it is
YOUR_BUCKET. - An access key and secret key. Below they are
YOUR_ACCESS_KEYandYOUR_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 = trueno_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/exportsrestic: 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-passwordCreate 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 snapshotsDatabases 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 --quietforget 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/resticrestic 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.