Skip to main content
Apidly Cloud
Cookie policy

Analytics and ad cookies stay off unless you accept. Cookie policy

We would like to use Google Analytics and Microsoft Clarity to understand how the public pages are used, including page views and session recordings, and the Reddit Pixel to measure whether our ads on Reddit lead to visits and sign-ups. You choose here whether they are on. Rejecting changes nothing about how the site works.

Back up to your own storage

Copy a folder from your server to your own S3-compatible bucket with a helper you run over SSH, and restore it to the same or a new server.

Last updated November 21, 20263 min read
View as Markdown

A server's disk goes away when you destroy the server. This page shows a way to keep a copy of a folder in your own bucket that works on every account, today. You run a small helper script on the server over SSH. It needs nothing from us.

How it works

  • You download gpu-backup.sh onto your server and check its checksum.
  • setup asks for your bucket details and saves them on the server. Any S3-compatible storage works: Amazon S3, Backblaze B2, Cloudflare R2, Wasabi, MinIO, Hetzner, DigitalOcean Spaces and others.
  • backup copies a folder to your-bucket/<name>/ and checks every file by checksum. restore copies it back.
  • The helper uses the open-source tool rclone. If rclone is missing on a Linux server, setup installs a pinned version for your user (no root needed) and verifies its SHA-256 checksum first.

Your keys stay on your server

The bucket keys are written to ~/.config/gpu-backup/rclone.conf, readable only by you (permission 600). They are never sent to us: the helper talks only to your storage provider. Use a key that can only reach this one bucket, and delete it at your provider when you no longer need it. gpu-backup.sh forget deletes the stored keys from the server.

Because the keys live on the server, anyone with access to your account on that server can read them. Do not share the server with people who should not see your bucket.

Step by step

Connect with SSH (see Connect over SSH), then:

# 1. Download and verify
curl -fsSLO https://apidly.com/downloads/gpu-backup.sh
curl -fsSL https://apidly.com/downloads/SHA256SUMS | grep ' gpu-backup\.sh$' | sha256sum -c - && chmod +x gpu-backup.sh

# 2. Save your bucket details (asks for endpoint, region, bucket, key and secret)
./gpu-backup.sh setup

# 3. Back up a folder
./gpu-backup.sh backup /workspace my-project

Other commands:

Command What it does
./gpu-backup.sh list Lists the backups in the bucket. list <name> lists the files of one backup
./gpu-backup.sh restore <name> <path> Copies a backup into a folder. Files with the same name are overwritten; nothing else is deleted
./gpu-backup.sh schedule "0 3 * * *" <path> [name] Adds a crontab line for a backup every day at 03:00
./gpu-backup.sh unschedule [name] Removes the lines it added
./gpu-backup.sh forget Deletes the stored keys and the scheduled lines. Your backups in the bucket stay

Add --dry-run to any command to see what it would do without changing anything. Add --exclude '*.tmp' (repeatable) or --exclude-common to skip caches and temporary files. By default backup only adds and updates files in the bucket; add --mirror to also remove files there that you deleted on the server.

For a setup without questions (for example in a script), set GPU_BACKUP_PROVIDER, GPU_BACKUP_ENDPOINT, GPU_BACKUP_REGION, GPU_BACKUP_BUCKET, GPU_BACKUP_ACCESS_KEY and GPU_BACKUP_SECRET_KEY before running setup.

Restore to a new server

  1. Deploy a new server and connect over SSH.
  2. Download the helper and run setup with the same bucket details.
  3. Run ./gpu-backup.sh list to see your backups, then ./gpu-backup.sh restore my-project /workspace.

Scheduling: only while the server runs

schedule uses the server's cron. Cron runs only while the server is running. A stopped or destroyed server makes no backups, and a run that was missed is not made up later. Schedule backups for times the server is normally on, and run one by hand before you destroy a server. If your server image has no cron, install it first or run backup yourself.

Costs

Storing and downloading the backup is charged by your own storage provider, under your agreement with them, not by us. Check their prices for storage, requests and downloads (some charge for data leaving their service). There is no extra fee from us for using the helper.

Limits

  • Backups are copies of files, not images of a whole server. Install software again on the new server or use a template.
  • The helper copies the files that exist when it runs; a file that is changing while it is copied may be copied in an inconsistent state. Stop the program that writes to a database before you back it up.
  • Check a restore on a spare folder before you rely on it.

See also Volumes and copies and Moving data.

Ready to try it?

Create a free account and add credit when you want to start a server. The smallest top-up is $10.

Create a free account

Was this helpful?

Still stuck? Contact us