Storing game world backups on the very same VPS or disk partition where the active game server is running is a common operational pitfall. An unexpected SSD failure, hypervisor crash, or ransomware infection can wipe out both the running world and the local backup directory simultaneously. A dependable disaster recovery strategy requires shipping cold snapshot archives to an independent offsite object storage bucket (AWS S3, Cloudflare R2, Wasabi, or Backblaze B2).
In this practical guide, we configure rclone for S3 endpoints, establish multi-threaded Zstandard compression pipelines, and automate a 14-day snapshot retention policy.
Offsite Backup Architecture and VPS Disaster Recovery#
A production-grade game backup pipeline adheres to four distinct phases:
- Flushed memory state to disk (triggering save routines via RCON).
- Creating an archive using multi-threaded
zstdcompression to preserve host CPU cycles. - Transmitting encrypted payloads over TLS into offsite object storage.
- Purging snapshots older than 14 days to control storage costs.
Install the required packages rclone and zstd:
sudo apt-get update && sudo apt-get install -y rclone zstd
rclone version | head -n 2
Configuring rclone and S3 Compatible Object Storage#
Define your S3 bucket endpoint credentials inside ~/.config/rclone/rclone.conf:
mkdir -p ~/.config/rclone
cat << 'EOF' > ~/.config/rclone/rclone.conf
[s3-backups]
type = s3
provider = Other
env_auth = false
access_key_id = YOUR_S3_ACCESS_KEY
secret_access_key = YOUR_S3_SECRET_KEY
endpoint = s3.storage.provider.net
acl = private
EOF
chmod 600 ~/.config/rclone/rclone.conf
Verify cloud connectivity and list available buckets:
rclone lsd s3-backups:
Restricting file permissions with chmod 600 prevents other unprivileged local users from reading your storage keys.
Snapshot Creation Script with Zstandard and Retention Rotation#
Create an automated script at /opt/scripts/backup_to_s3.sh, guarded with an exclusive flock file descriptor to prevent concurrent executions:
cat << 'EOF' > /opt/scripts/backup_to_s3.sh
#!/usr/bin/env bash
set -euo pipefail
LOCKFILE="/tmp/gamehost_backup.lock"
exec 200>"$LOCKFILE"
flock -n 200 || exit 0
BACKUP_DIR="/tmp/backups"
SOURCE_DIR="/opt/game-servers"
DATE=$(date +%Y-%m-%d_%H%M%S)
ARCHIVE_NAME="gameserver_backup_${DATE}.tar.zst"
REMOTE_BUCKET="s3-backups:game-backups-prod"
mkdir -p "$BACKUP_DIR"
# Сжатие данных с алгоритмом Zstandard (быстро и с высокой степенью компрессии)
tar -I 'zstd -T4 -3' -cf "${BACKUP_DIR}/${ARCHIVE_NAME}" -C "$SOURCE_DIR" .
# Загрузка архива в S3-хранилище
rclone copy "${BACKUP_DIR}/${ARCHIVE_NAME}" "${REMOTE_BUCKET}/daily/"
# Удаление локального временного файла
rm -f "${BACKUP_DIR}/${ARCHIVE_NAME}"
# Ротация: удаление архивов в S3 старше 14 дней
rclone delete --min-age 14d "${REMOTE_BUCKET}/daily/"
EOF
chmod +x /opt/scripts/backup_to_s3.sh
The zstd -T4 -3 directive utilizes 4 CPU threads with balanced compression level 3, packing a 10 GB world directory in under 40 seconds without inducing in-game tick stalls.
Cron Scheduling and Restoration Testing#
Schedule the backup script to run nightly at 04:00 server time:
(crontab -l 2>/dev/null; echo "0 4 * * * /opt/scripts/backup_to_s3.sh >> /var/log/gamehost_backup.log 2>&1") | crontab -
crontab -l | grep backup_to_s3
To verify disaster recovery preparedness, download the latest archive into a staging test directory:
rclone copy $(rclone lsf s3-backups:game-backups-prod/daily/ | tail -n 1) /tmp/restore/
tar -I zstd -xf /tmp/restore/*.tar.zst -C /tmp/restore_test/
If you prefer automated geo-distributed S3 snapshot protection with one-click restore points across a 30-day timeline, high-reliability game server hosting handles complete storage orchestration and world redundancy automatically.




