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.shonto your server and check its checksum. setupasks 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.backupcopies a folder toyour-bucket/<name>/and checks every file by checksum.restorecopies it back.- The helper uses the open-source tool rclone. If rclone is missing on a Linux server,
setupinstalls 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-projectOther 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
- Deploy a new server and connect over SSH.
- Download the helper and run
setupwith the same bucket details. - Run
./gpu-backup.sh listto 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.
Was this helpful?